[comp.lang.c] SIMPLE getchar

wallace@ynotme.enet.dec.com (Ray Wallace) (10/04/90)

In article <14737@mentor.cc.purdue.edu>, schikore@mentor.cc.purdue.edu (Dan Schikore) writes...
>I am having trouble getting TC 2.0 to read in a binary 0.  It considers
>it EOF.  I simply have the statement:
> 
>while ((i=getc(fp)) != EOF) {}
When you open the file do you open it as a BINARY file? If not then you need
to. ie:
	fp = fopen( "name", "rb" );
---
Ray Wallace		
		(INTERNET,UUCP) wallace@oldtmr.enet.dec.com
		(UUCP)		...!decwrl!oldtmr.enet!wallace
		(INTERNET)	wallace%oldtmr.enet@decwrl.dec.com
---

akcs.dgy@vpnet.chi.il.us (Donald Yuniskis) (10/05/90)

use feof(...) to test end of file as EOF is a valid integer...