view docs/ccguide/chap4.chapter @ 2772:0a3f4d8ea6d5

Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected. Moved the native 6309 code in dwread.asm and dwwrite.asm into the H6309 labeled area and changed IFEQ H6309 to IFNE H6309. Also moved the 57600bps 6809 code to the default location. This change had been done in the old dwread.asm and dwwrite.asm files to make it easier to follow. Though these two files were overwritten from the HDBDOS project dwread.asm and dwwrite.asm files. So this conversion needed to be done again so it made the source easier to follow.
author drencor-xeen
date Wed, 23 Jan 2013 12:36:55 -0600
parents 497d17b4b264
children
line wrap: on
line source

<chapter>
<title>C Standard Library</title>
<para>
The Standard Library contains functions which fall into two
classes: high-level I/O and convenience.
</para>
<para>
The high-level I/O functions provide facilities that are
normally considered part of the definition of other languages; for
example, the FORMAT "statement" of Fortran. In addition, automatic
buffering of I/O channels improves the speed of file access because
fewer system calls are necessary.
</para>
<para>
The high-level I/O functions should not be confused with the
low-level system calls with similar names. Nor shoul "file
pointers" be confused with "path numbers". The standard library
functions maintain a structure for each file open that holds status
information and a pointer into the files buffer, A user program
uses a pointer to this structure as the "identity" of the file
(which is provided by "fopen()"), and passes it to the various
I/O functions. The I/O functions will make the low-level system
calls when necessary.
</para>
<para>
<emphasis>Using a file pointer in a systen call, or a path number in a
Standard Library call</emphasis>, is a common mistake among beginners to C and,
if made, will be sure to <emphasis>crash your program.</emphasis>
</para>
<para>
The convenience functions include facilities for copying,
comparing, and concatening strings, converting numbers to strings,
and doing the extra work in accessing systen information such as the
time.
</para>
<para>
In the page which follow, the functions available are
described in terms of what they do and the parameters they expect.
The "USAGE" section shows the name of the function and the type
returned (if not int). The declaration of arguments are shown as
they would be written in the function definition to indicate the
types expected by the function. If it is necesary to include a
file before the function can be used, it is shown in the "USAGE"
section by "#include &lt;filename&gt;".
</para>
<para>
Most of the header files that are required to be included, must
reside in the "DEFS" directory on the default system drive. If the
file is included in the source program using angle bracket
delimiters instead of the usual double quotes, the compiler will
append this path name to the file name. For example, "#include &lt;stdio.h&gt;"
is equivalent to "#include &lt;/d0/defs/stdio.h&gt;", if "/d0" is
the path name of the default system drive.
</para>
<para>
<emphasis>Please note</emphasis> that if the type of the valye returned by a
function is not INT, you should make a pre-declaration in your
program before calling it. For example, if you wish to use
"atof()", you should pre-declare by having "double atof();"
somewhere in your program before a call to it. Some functions
which have associated header files in the DEFS directory that
should be included, will be pre-declared for you in the header. An
example of this is "ftell()" which is pre-declared in "stdio.h". If
you are in any doubt, read the header file.
</para>

&atofref;
&fcloseref;
&feofref;
&findstrref;
&fopenref;
&freadref;
&fseekref;
&getcref;
&getsref;
&isalpharef;
&l3tolref;
&longjmpref;
&mallocref;
&mktempref;
&printfref;
&putcref;
&putsref;
&qsortref;
&scanfref;
&setbufref;
&sleepref;
&strcatref;
&systemref;
&toupperref;
&ungetcref;
</chapter>