EOF with fgets()

Kim Wallen kim at emory.UUCP
Tue Nov 1 12:14:50 AEST 1983


From:!sb1!sb6!emory!kim

I have been trying to use fgets() to read lines from a file inside a while
loop which tests to see if fgets() returns a NULL.  The lines are read in
and the loop seems to terminate, but I always get an illegal instruction
error at the end of main().  I have tried using fscanf() and checking for
EOF, but get the same error.  Any guidance on how I can get a line scanning
program to terminate correctly at the end of a file would be greatly
appreciated.

Kim Wallen
Psychology Dept.
Emory University
Atlanta, GA 30322


!sb1!sb6!emory!kim



More information about the Comp.lang.c mailing list