From: Uwe Bonnes Newsgroups: comp.os.msdos.djgpp Subject: Re: C compiler inserts 0x0d before 0x0a? Date: 24 Jul 2000 08:24:31 GMT Organization: TU Darmstadt Lines: 22 Message-ID: <8lgufv$69m$1@sun27.hrz.tu-darmstadt.de> References: <397BFC7C DOT 111C0896 AT ethernet DOT com> NNTP-Posting-Host: hertz.ikp.physik.tu-darmstadt.de User-Agent: tin/pre-1.4-980618 (UNIX) (Linux/2.2.16 (i686)) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Jim Smith wrote: : I just installed the latest djgpp C compiler on my Windows 98 machine, : and I cannot make this simple program work correctly. It is supposed : to simply open a file and write out 5 bytes. It does work correctly : (without any changes) on Linux. The Windows version always inserts a : 0x0d before every 0x0a. On Windows my output file ("junkfile") has a : total of 7 bytes ( two 0x0d bytes added), but on Linux my output file : has a total of 5 bytes, as expected. Welcome to the wonderfull world of DOS CR/LF linebreaks. If you write out a text file on dos, you will get those CR/LF endings. Open with O_BINARY to circumvent. Bye -- Uwe Bonnes bon AT elektron DOT ikp DOT physik DOT tu-darmstadt DOT de Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------