Mail Archives: djgpp/1999/07/29/11:42:46
In article <19990728 DOT 061228 DOT -4108575 DOT 0 DOT nine1one AT juno DOT com> you wrote:
> Whenever I write the value 13 to a file and read it back I get a large
> number, as if it shifted bytes and is reading a value in the upper byte
> of the short integer.
> /* create the file of 15 records */
> fptr=fopen("junk","w");
^^^^ make that "wb" and watch the difference
> fptr=fopen("junk","r");
^^^^^ "rb", here.
You're being hit by the difference betweeen what the C standard and
DOS understand as being a 'text file'. Yours isn't really a text file,
at all, so you must *tell* the compiler about that fact.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -