From: "Christopher Nelson" To: Subject: Re: libc bug? Date: Fri, 26 Mar 1999 06:23:29 -0700 Message-ID: <01be778b$d63f8880$LocalHost@thendren> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.71.1712.3 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Reply-To: djgpp AT delorie DOT com -----Original Message----- From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp To: djgpp AT delorie DOT com Date: Wednesday, March 24, 1999 11:33 PM Subject: Re: libc bug? >In article <01be764f$7b2ea120$LocalHost AT thendren> you wrote: >[...] >> part of the code requires me to create temporary files and write some >> compressed information into that file. since libc has a tmpfile() function, >> is used that. however, when i write compressed information to the file and >> then retrieve it, it does not come back the same. > >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? if you want to leave text for some reason, you're not going to use a temporary file, you're going to open a real file. the whole point of a temporary file is to save binary information for a moment. any idea WHY this particular design decision was taken? or did they just open the file in default mode just 'cause? -={C}=-