Hardware Reference
In-Depth Information
Include files
A number of include (or header ) files are provided within a set of C run-time
library. These files contain macro and constant definitions, type definitions and
function declarations. Such files are given the file extension, .h and some of
the more common include files are listed below:
Contains functions, declarations, and structure definitions for the
BIOS service routines.
bios.h
Contains function declarations for the console and port I/O
routines (e.g. cgets , cputs , getch , inp , inpw , outp , and outpw ).
conio.h
Defines unacros and constants audi declares global arrays used
in character classification (e.g. isalnum , isalpha , islower ,
isupper , toascii , tolower , toupper , etc.).
ctype.h
Contains
macro
definitions,
function
declarations,
and
type
dos.h
definitions for the MS-DOS interface.
Contains function declarations for file handling and low-level I/O
functions, such as open , close , read , and write .
io.h
Contains function declarations for the memory allocation func-
tions (e.g. malloc , calloc , free , etc.).
malloc.h
Contains function declarations for all floating-point mathematics
routines (e.g. abs , sin , cos , log , loglO , exp , etc.).
math.h
Contains definitions of constant, macros, and types. Also contains
function declarations for the stream I/O functions. The function
definitions include fopen , fclose , fread , printf , and scanf .
The constants defined within stdio.h include BUFSIZ (buffer
size), EOF (end of file marker), and NULL .
stdio.h
Contains
function
definitions
which
include
abort,
exit,
and
stdlib.h
system.
string.h Contains definitions for the string manipulation functions (e.g.
strcpy , strlen , and strcat ).
It is important to note that many programs use macros, constants, and types
that are defined in separate include files. Each file containing such a defini-
tion must be specified within the source file (using the pre-processor directive
#include ), for example:
#inc1ude <stdio.h>
Streams
Streams are an abstraction used in C and C ++ for input and output operations
through a system of I/O based on characters . Streams operate with files, key-
board, printer, screen, and I/O ports. When a program that includes stdio.h
begin its execution, three predefined streams are opened:
This is the standard input stream. By default stdin corresponds to
the keyboard, but this can be redirected by the operating system.
stdin
This is the standard output stream. By default stdout is directed
to the screen, but the operating system can redirect it to a file or
any other output device.
stdout
Search WWH ::




Custom Search