From: cgf AT cygnus DOT com (Christopher G. Faylor) Subject: Re: B19 problem with fread() and buffering 5 Sep 1998 21:11:04 GMT Message-ID: <6ss9d8$l1t$1@cronkite.cygnus.com> References: <3 DOT 0 DOT 3 DOT 32 DOT 19980904184440 DOT 00ba7d50 DOT cygnus DOT gnu-win32 AT appr> X-Newsreader: trn 4.0-test63 (15 March 1998) In article <3 DOT 0 DOT 3 DOT 32 DOT 19980904184440 DOT 00ba7d50 DOT cygnus DOT gnu-win32 AT appr>, Todd Massey wrote: > >I call fread with a sizeof of 4 and a count of 315 after reading >500 bytes out of a file and I only get back a count of 42 and then >the FILE* fp->_flags == 1188, when I called fread() it fp_uflags was 1156, so >for some reason it thinks it reached end of file. Now this is a binary >file and I use fopen() to open it .. I would expect it to work just fine >the routine that wrote out the file used fwrite in the B19 stuff.. > >So the real question is.. am I over running some buffer? You probably need to open your file as binary: FILE *fp = fopen("whatever", "rb"); Otherwise, cygwin, will attempt to translate \r\n to \n and it will treat a ^Z specially. -- cgf AT cygnus DOT com "Everything has a boolean value, if you stand http://www.cygnus.com/ far enough away from it." -- Galena Alyson Canada