home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc / qc25 / rdfile.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-15  |  393 b   |  19 lines

  1. /* RDFILE.C: Reads a file and prints characters to the screen. */
  2. #include <stdio.h>
  3.  
  4. main()
  5. {
  6.    int c;
  7.    FILE *fp;
  8.  
  9.    if( fp = fopen( "c:\\testfile.asc", "rb" ) )
  10.    {
  11.       while( (c = fgetc( fp )) != EOF )
  12.          printf( " %c\t%d\n", c, c );
  13.       printf( "\nEnd of file marker: %d", c );
  14.       fclose( fp );
  15.    }
  16.    else
  17.       printf( "Error in opening file\n" );
  18. }
  19.