Console Input/ Output
C simply has no provision for receiving data from any of the input device (like keyboard, floppy disk, etc.), nor for sending data to the output devices (like VDU, floppy disk, etc.). Thus C has no provision for I/O. Each OS has its own facility for I/O data form to the files and devices. A series of standard I/O functions were written and added to the libraries of C. These functions link the C compiler for particular Operating System’s I/O facilities. Though these functions are not part of C formal definition, they have become a standard feature of C language.
Unformatted Functions
|
Type
|
Input
|
Output
|
char
|
getch( )
|
putch( )
|
|
getche( )
|
-
|
|
getchar( )
|
putchar( )
|
Int
|
-
|
-
|
float
|
-
|
-
|
string
|
gets( )
|
puts( )
|
Console Input and Output Functions
Formatted Functions
|
Type
|
Input
|
Output
|
char
|
scanf( )
|
printf( )
|
Int
|
scanf( )
|
printf( )
|
float
|
scanf( )
|
printf( )
|
string
|
scanf( )
|
printf( )
|