DPRG
DPRG List  



[DPRG] C programming question - reading binary files

Subject: [DPRG] C programming question - reading binary files
From: Chuck McManis cmcmanis at mcmanis.com
Date: Fri Sep 17 09:12:05 CDT 2004

At 12:36 AM 9/17/2004, Dave Hylands wrote:
>The 'b' parameter will only be meaningful on DOS/Windows platforms, and
>it prevents \n from being translated to \r\n when writing the file and
>prevents \r\n being translated into \n when reading the file.

But most importantly it prevents ^Z from being interpreted as the end of 
the file.

I tend to agree with most people here that the problem is likely in the 
declaration of val. However it could be that the file is empty as well. 
Have you dumped it out to verify that it has data in it?

Given that you're not using *any* of the STDIO functions (except iseof()) 
you might consider switching to plan old read as that will give your robot 
a smaller program possibly. (not using stdio can help save a huge library 
from being linked into your program)


--Chuck


More information about the DPRG mailing list