delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/08/11:42:47

Date: Tue, 8 Dec 1998 11:42:34 -0500
Message-Id: <199812081642.LAA05459@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
CC: HANRIGOU AT cgste DOT mq
In-reply-to: <366D541F.7E73636E@CGSTE.MQ> (message from HANRIGOU on Tue, 08
Dec 1998 12:30:23 -0400)
Subject: Re: read/write in binary mode: fopen/open behaviour
References: <366D541F DOT 7E73636E AT CGSTE DOT MQ>
Reply-To: djgpp AT delorie DOT com

> Nevertheless is this behaviour correct? Couldn't we expect file mode
> changes on FILE *f to be automatically applied to fileno(f)? Please
> give me a clue.

FILE* streams don't use read() or write(), they use _read() and
_write() directly, and manage the text/binary conversions themselves.
Why?  So they can do fseek() and ftell() properly.

However, if you open a file with "rb" it does open the underlying
descriptor with O_BINARY, so it should work as you expect.  Are you
using 2.01 or 2.02?

- Raw text -


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