home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: fwrite+fread of pointer
- Message-ID: <1992Nov13.184421.11065@taumet.com>
- Organization: TauMetric Corporation
- References: <15935@goanna.cs.rmit.oz.au>
- Date: Fri, 13 Nov 1992 18:44:21 GMT
- Lines: 21
-
- ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
-
- >I would like to know what the standard says about the following program:
-
- [ writes the contents of a pointer with fwrite, reads it back with fread ]
-
- >What I want to know is whether, assuming nothing else goes wrong, the
- >program _must_ print 1 or whether it may print 0.
-
- [ that is, whether the value read == the value written ]
-
- ANSI C Standard 4.9.2:
-
- "Data read in from a binary stream shall compare equal to the data that
- were earlier written out to the stream, under the same implementation."
-
- In the example, the file was opened in binary mode, so this applies.
- --
-
- Steve Clamage, TauMetric Corp, steve@taumet.com
- Vice Chair, ANSI C++ Committee, X3J16
-