- #include <stdio.h>
- int main ( void )
- {
- FILE *stream;
- /* open a file for reading */
- stream = fopen ( "DUMMY.FIL", "r" );
- /* read a character from the file */
- fgetc ( stream );
- /* check for EOF */
- if ( feof ( stream ) )
- printf ( "We have reached end-of-file\n" );
- /* close the file */
- fclose ( stream );
- return 0;
- }
转载于:https://blog.51cto.com/laoye/1055528