C Programming Tutorial
Computer Tutorial

File Handling Functions



File Handling Functions

Name Function
fopen( ) Opens a file
fclose( ) Closes a file
putc( ) Writes a character to a file
fputc( ) Same as putc( )
getc( ) Reads a character from a file
fgetc( ) Same as getc( )
fgets( ) Reads a string from a file
fputs( ) Writes a string to a file
Name Function
fseek( ) Seeks to a specified byte in a file
ftell( ) Returns the current file position
fprintf( ) Is to a file what printf( ) is to the console
fscanf( ) Is to a file what scanf( ) is to the console
feof( ) Returns true if end-of-file is reached
ferror( ) Returns true if an error has occurred
rewind( ) Resets the file position indicator to the beginning of the file
remove( ) Erases a file