Mail Archives: djgpp/1997/10/09/09:15:13
At 14.07 1997-10-01 GMT, you wrote:
>I am trying to get djgpp to do a raw memory dump to a file. I wrote the
following
>small program to output 1000 double float variables. The file produced
should be
>exactly 8000 bytes long. However, the program produces files with lengths
that vary
>each time but are typically 8020 bytes long. Needless to say, replacing
the fwrite
>to an fread to read in the file produces garbage. What is going on ??
>Is there another way of doing it ?
>I tried the program with gcc 2.6.3 on a Sun workstation and that works ok
(i.e
>output files are 8000 bytes long and can be read in to give meaningful
values).
>HELP!!!!
>
Well, this must be the most commonly asked question around here. And I am
99.99% certain that your problem is that you did not open the file in
binary mode. Under UNIX that doesn't make any diffrence, but in DOS it
surely does!
use FILE *fin = fopen("file.out", "wb");
-- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se --
*****************************************************
* A brief description of DJGPP: *
* NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! *
*****************************************************
- Raw text -