-

Changes

Jump to: navigation, search

Standard Libraries

5 bytes added, 10:58, 26 July 2017
no edit summary
8.1. == Standard I/O==
C is a language which does not specify the I/O facilites in the language itself; rather all I/O is performed via library routines. In practice this results in I/O handling which is no less convenient than any other language, with
are listed in detail in a subsequent section of the manual.
8.2. == Compatibility==
The libraries supplied with HI-TECH C are highly compatible with the ANSI libraries, as well as the V7 UNIX libraries, both at the Standard I/O level and the UNIX system call level. The Standard I/O library is complete, and
conforms in all respects with the UNIX Standard I/O library. The library routines implementing UNIX system call like functions are as close as possible to those system calls, however there are some UNIX system calls that cannot be simulated on other systems, e.g. the link() operation. However the basic low level I/O routines, i.e. open, close, read, write and lseek are identical to the UNIX equivalents. This means that many programs written to run on UNIX, even if they do not use Standard I/O, will run with little modification when compiled with HI-TECH C.
8.3. == Libraries for Embedded Systems==
The cross compilers, designed to produce code for target systems without operating systems, are supplied with libraries implementing a subset of the STDIO functions. Not provided are those functions dealing with files. Included
are _�p_�r_�i_�n_�t_�f(), _�s_�c_�a_�n_�f() etc. These operate by calling two low level functions _�p_�u_�t_�c_�h and _�g_�e_�t_�c_�h() which typically send and receive characters via a serial port. Where the compiler is aimed at a single-chip micro with on-board UART this is used. The source code for all these functions is supplied enabling the user to modify it to address a different serial port.
8.4. == Binary I/O==
On some operating systems, notably CP/M, files are treated differently according to whether they contain ASCII (i.e. printable) or binary data. MD-DOS also suffers from this problem, not due to any lack in the operating system
ment to the STDIO routines may be regarded as a handle on the corresponding stream. A stream may be viewed as a featureless sequence of bytes, originating from or being sent to a device or file or even some other indeterminate source. A FILE pointer should not be confused with the 'file descriptors' used with the low-level I/O functions _�o_�p_�e_�n(), _�c_�l_�o_�s_�e(), _�r_�e_�a_�d() and _�w_�r_�i_�t_�e(). These form an independent group of I/O functions which perform unbuffered reads and writes to files.
8.5. == Floating Point Library==
HI-TECH C supports floating point as part of the language, however the Z80 implementation provides single precision only; double floats are permitted but are no different to floats. In addition, the standard library,

Navigation menu