PDS: CS 11002 Computer Sc & Engg: IIT Kharagpur 1
File Access
& %
Lect 29 Goutam Biswas
, ' $
PDS: CS 11002 Computer Sc & Engg: IIT Kharagpur 2
Standard I/O
So far all our I/O operations are read from the
standard input (stdin - keyboard) and write to
the standard output (stdout - VDU) devices.
These are defined and connected to the running
program (process) by the OS.
& %
Lect 29 Goutam Biswas
, ' $
PDS: CS 11002 Computer Sc & Engg: IIT Kharagpur 3
stdin & stdout
In Unix/Linux operating systems these input
and output streams are treated as two files
stdin and stdout respectively. The printf(),
scanf() functions and the getchar(),
putchar() functions/macros are used to access
these files.
& %
Lect 29 Goutam Biswas
, ' $
PDS: CS 11002 Computer Sc & Engg: IIT Kharagpur 4
File Access Functions
But we like to open other files for read, write or
append. Following C library functions are used
for this purpose: fopen(), fclose(),
fseek(), fprintf(), fscanf(), getc(),
putc() etc.
& %
Lect 29 Goutam Biswas