www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/30/07:18:18

From: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C compiler inserts 0x0d before 0x0a?
Date: Sun, 30 Jul 2000 12:08:44 +0100
Organization: Customer of Energis Squared
Lines: 17
Message-ID: <hi28osct9a0gdq9opkoafa9f4i5ecmaorv@4ax.com>
References: <397BFC7C DOT 111C0896 AT ethernet DOT com> <8lgufv$69m$1 AT sun27 DOT hrz DOT tu-darmstadt DOT de> <3983639C DOT 16732F85 AT ethernet DOT com>
NNTP-Posting-Host: modem-34.vanadium.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news6.svr.pol.co.uk 964955433 1086 62.136.22.34 (30 Jul 2000 11:10:33 GMT)
NNTP-Posting-Date: 30 Jul 2000 11:10:33 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Agent 1.7/32.534
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Jim Smith <jsmith AT ethernet DOT com> wrote:

> > Open with O_BINARY to circumvent.
> 
> Thanks to those who replied with the above suggestion.  However, it still
> does not work.  As shown below, I simply added the O_BINARY word to the file
> open, but the extra bytes (0x0d) are still inserted into the output file.
> I'm lost.  Thanks for any help.

Try deleting junkfile before running the program, or open with O_TRUNC
instead of O_CREAT.

Your original program will produce a 7-byte file.  With O_BINARY, the
program writes only 5 bytes but if the file already exists it won't be
truncated.

"info libc a open" lists the options and their meanings.

- Raw text -


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