X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Richard Dawe Newsgroups: comp.os.msdos.djgpp Subject: Re: write, _write, fwrite Date: Sat, 02 Mar 2002 17:02:46 +0000 Lines: 22 Message-ID: <3C8105B6.B1DAFC36@phekda.freeserve.co.uk> References: <20020225130908 DOT A7403 AT kendall DOT sfbr DOT org> <200202251913 DOT g1PJDIx31078 AT envy DOT delorie DOT com> NNTP-Posting-Host: modem-136.vanadium.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newsg4.svr.pol.co.uk 1015089243 26772 62.136.22.136 (2 Mar 2002 17:14:03 GMT) NNTP-Posting-Date: 2 Mar 2002 17:14:03 GMT X-Complaints-To: abuse AT theplanet DOT net X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586) X-Accept-Language: de,fr To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com DJ Delorie wrote: > > > What are the considerations for choosing between the write, _write, and > > fwrite procedures? (And the corresponding read, _read, and fread.) From > > the libc docs I see some differences in the prototypes, but otherwise the > > choice seems mainly related to portability. Is this correct? > > buffered cr/lf Standard > conversion > fwrite fread Yes Yes ANSI > write read No Yes POSIX > _write _read No No DOS NB: write() will only do CRLF conversion if the O_TEXT flag is being used for the file. If O_BINARY is being used, then it won't. See src/libc/posix/unistd/write.c from the DJGPP sources. You can set O_TEXT or O_BINARY on open(). HTH, bye, -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]