🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3579

Re: fwrite(), fread() portability.

#3579
From: Stan Friesen
Date: Mon, 31 Jul 1995 16:03
30 lines
1569 bytes
In article <rZQHwACMBh107h@rcp.co.uk>, alan@rcp.co.uk (Alan Stokes) writes:
|> In <danpop.807025255@rscernix> Dan.Pop@mail.cern.ch (Dan Pop) writes:
|> 
|> >  fread is supposed to read data written by
|> >fwrite 
|> Agreed, probably.

This *is* required by the standard.
|> 
|> >and fwrite will write a 4-byte quantity as 4 characters in the
|> >file.  
|> Says who? I don't see anything in the standard that requires this.

Quite.

As long as fread exactly reverses the conversion done by fwrite, the
requirements of the standard are mt.

Note, the main reason for the way it is written is the existance of some systems
on which writing to a file opened in text mode causes conversion of the NL
character into a two character sequence.

|> But fread and fwrite are apparently free to add their own encoding.

Absolutely.

-- 
swf@elsegundoca.attgis.com		sarima@netcom.com

The peace of God be with you.
Technical Details
Message-ID: <DCL8MH.1Ky@lcpd2.SanDiegoCA.ATTGIS.COM>
Path: arc1-ca.pugleaf.net!elsegundoca.ncr.com!swf
References: <3vav3a$4bi@lyra.csx.cam.ac.uk> <3vat5j$kak@engnews2.Eng.Sun.COM> <3vappo$1uj@lyra.csx.cam.ac.uk> <DCFBC9.3Ar@westminster.ac.uk> <danpop.807025255@rscernix> <rZQHwACMBh107h@rcp.co.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!elsegundoca.ncr.com!swf
From: swf@elsegundoca.ncr.com (Stan Friesen)
Subject: Re: fwrite(), fread() portability.
Message-ID: <DCL8MH.1Ky@lcpd2.SanDiegoCA.ATTGIS.COM>
Sender: news@lcpd2.SanDiegoCA.ATTGIS.COM (News Administrator)
Nntp-Posting-Host: tools3.elsegundoca.attgis.com
Reply-To: swf@elsegundoca.ncr.com
Organization: NCR Teradata Database Business Unit
References: <3vav3a$4bi@lyra.csx.cam.ac.uk> <3vat5j$kak@engnews2.Eng.Sun.COM> <3vappo$1uj@lyra.csx.cam.ac.uk> <DCFBC9.3Ar@westminster.ac.uk> <danpop.807025255@rscernix> <rZQHwACMBh107h@rcp.co.uk>
Date: Mon, 31 Jul 1995 16:03:53 GMT