[prog] C problem I am unable to solve

Dan dan at cellectivity.com
Fri May 13 01:11:10 EST 2005


> The problem I have now is an infinate loop once it reaches the end of
> the file.

I think the problem is here:

>      while ( (c = getc(inputfile)) != '\n' )
>         putc(c, stdout); /* display the line */

EOF is not '\n'     :-)

Don't be too hard on yourself for not seeing it: paradoxically, it's
often easier to see bugs in code you're not already familiar with.

-- 
    He doesn't have ulcers, but he's a carrier.
               - Anonymous




More information about the Programming mailing list