delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/11/18:53:08

Date: Wed, 11 Jul 2001 18:17:01 -0400
Message-Id: <200107112217.SAA26715@envy.delorie.com>
X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
CC: bastian AT hc DOT ti DOT com
In-reply-to: <Pine.GSO.4.33.0107111632200.4160-202000@brahms> (message from
Jeff Bastian on Wed, 11 Jul 2001 16:39:43 -0500 (CDT))
Subject: Re: broken fread()
References: <Pine DOT GSO DOT 4 DOT 33 DOT 0107111632200 DOT 4160-202000 AT brahms>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> The output was exactly as it should be until the byte 0x0d showed up in
> the COFF file.  Then, the output was all shifted by 1 byte.

You need to open the file in binary mode, not the default text mode.
Text mode converts cr/lf pairs into C newlines (\n).

Binary mode is "rb" with fopen, or O_BINARY with open.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019