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 To: djgpp AT delorie DOT com CC: bastian AT hc DOT ti DOT com In-reply-to: (message from Jeff Bastian on Wed, 11 Jul 2001 16:39:43 -0500 (CDT)) Subject: Re: broken fread() References: 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 Precedence: bulk > 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.