delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/10/10:04:07

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: putc and '0x0A'
Date: Wed, 07 May 1997 20:55:06 -0700
Organization: Alcyone Systems
Lines: 25
Message-ID: <33714E9A.40095C99@alcyone.com>
References: <336FA4A7 DOT 1FA3 AT molly DOT mpimf-heidelberg DOT mpg DOT de>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Stephan Weber wrote:

> . . . one of the characters in EPROM2 is a '0x0A'
> fputc/fprintf sends a '0x0D 0x0A' to the stream.
> 
> I checked the field EPROM2[j] with a printf and
> there is really just the '0x0A' with no '0x0D'
> before it.
> 
> How can I suppress this behavier of fputc/fprintf?

Open the file in binary mode.  Add a `b' in the mode string sent to fopen.

> Are there any other hidden (DOS/ASCII) conversions?

This is complaint ANSI C.  If you want to deal with the data itself,
always open it in binary mode.

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
                      "The future / is right there."
                                 / Bill Moyers

- Raw text -


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