fopen function


fopen is used to open a file for read, write or update. stdin, stdout & stderr are opened by the system at execution time.


Library:   stdio.h

Prototype: FILE *fopen(const char *filename, const char *mode);

Syntax:    FILE *fp;
	   fp = fopen( "/etc/printcap", "r");

Notes:

	filename - is the name of the file.
	mode     - r - read file.
                 - w - Write to file.
                 - a - Append to file.


Example Programs:

Example program.


See Also:

fgetc Get a character from a file.
fgets Get a record from a file.
fputc Put a character into a file. MAN PAGE.
fprintf Put a formatted line into a file.
fclose Close a file.
pclose Close a pipe.
system Open a pipe.
ferror. Check error code on a file stream.
feof. Check for EOF on a file stream.


Top Master Index Keywords Functions


Martin Leslie