This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/feof.c

21 lines
351 B
C
Raw Permalink Normal View History

#include <stdio.h>
void process_record( char *buf )
{
printf( "%s\n", buf );
}
void main( void )
{
FILE *fp;
char buffer[100];
fp = fopen( "file", "r" );
fgets( buffer, sizeof( buffer ), fp );
while( ! feof( fp ) ) {
process_record( buffer );
fgets( buffer, sizeof( buffer ), fp );
}
fclose( fp );
}