delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/30/15:39:27

Date: Fri, 30 May 1997 21:00:02 +0000
From: "X DOT PONS AT UAB DOT ES" <ILGES AT cc DOT uab DOT es>
Subject: tmpfile() and binary mode in DJGPP
To: djgpp AT delorie DOT com
Message-id: <01IJHT6V95V6001VQJ@cc.uab.es>
Organization: Universitat Autonoma de Barcelona
MIME-version: 1.0

We have "discovered" that tmpfile() opens the temporay file in
the mode (binary or text) resulting from :
     _fmode & O_TEXT
As the usual mode is text, the temporary file is created in text mode.

Of course we can change the default mode for opening files, but
we think it will be better that the DJGPP compiler open the temporary
file in binary mode because:
  - My 1989 book of ANSI C states that the file opened using
    tmpfile() is always a binary file.
  - The help of TC and BC compilers also states this and really
    create the file in "w+b" mode, never in text mode.
  - It seems more adequate for temporary files to be in binary
    mode. Of course this will be a problem if you want a text file,
    but it is probably not very usual.

If you, DJGPP gurus, do not agree with us (and with our colleagues
that love a lot the DJ compiler, but that have wasted a lot of time
trying to understand a problem derived from this "characteristic"
of the tmpfile() function), at least, please include this asymmetry
on the FAQ.

Thanks a lot!


Xavier Pons and Joan Maso

- Raw text -


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