www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/21/20:16:38

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C-style FILE IO problems..
Date: Sat, 21 Dec 1996 16:00:25 -0800
Organization: Alcyone Systems
Lines: 19
Message-ID: <32BC7A19.27AF51AB@alcyone.com>
References: <59enik$foo AT news DOT luth DOT se> <32BB5A76 DOT 27EC1FC AT alcyone DOT com> <59ggmj$3l AT news DOT luth DOT se>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Roland Nilsson wrote:

> Yes, I'm parsing binary files. I believe C FILE i/o is always in raw
> mode. The only fopen() flags available are those relating to i/o
> direction and overwrite, according to my djgpp function list.
> I usually fopen() with "r".

No.  Specifying a mode parameter of "r" means read in text mode.
End-of-line character sequences will be transformed into newlines on read,
and vice versa when writing.

Open it with a mode parameter of "rb" for read in _binary_ mode.

-- 
                             Erik Max Francis | max AT alcyone DOT com
                              Alcyone Systems | http://www.alcyone.com/max/
                         San Jose, California | 37 20 07 N 121 53 38 W
                                 &tSftDotIotE | R^4: the 4th R is respect
     "You must surely know if man made heaven | Then man made hell"

- Raw text -


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