Message-ID: <3700E2DC.D6974F5C@cyberoptics.com> From: Eric Rudd Organization: CyberOptics X-Mailer: Mozilla 4.05 [en] (Win95; U) MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: libc bug? References: <01be778b$d63f8880$LocalHost AT thendren> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 22 NNTP-Posting-Host: 206.144.150.73 X-Trace: news2.randori.com 922805081 (Tue, 30 Mar 1999 06:44:41 PST) NNTP-Posting-Date: Tue, 30 Mar 1999 06:44:41 PST Date: Tue, 30 Mar 1999 08:42:37 -0600 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Christopher Nelson wrote: > >This is most probably due to the fact that (your version of) tmpfile() > >opens the file in text, not in binary mode. Either explicitly set it > >to binary post hoc, using the 'setmode(fileno(file), O_BINARY)' > >method, or use tmpnam()/fopen() instead of tmpfile(). > > opens in text? doesn't that kind of negate the effects of a temporary file? According to ANSI/ISO 9899-1990, clause 7.9.4.3, "The tmpfile function creates a temporary binary file that will automatically be removed when it is closed or at program termination. If the program terminates abnormally, whether an open temporary file is removed is implementation-defined. The file is opened for update with "wb+" mode." Thus, an implementation of tmpfile() that opens the file in text mode would not conform to the standard. -Eric Rudd rudd AT cyberoptics DOT com