home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / std / c / 3004 < prev    next >
Encoding:
Text File  |  1992-11-14  |  1018 b   |  32 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: fwrite+fread of pointer
  5. Message-ID: <1992Nov13.184421.11065@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <15935@goanna.cs.rmit.oz.au>
  8. Date: Fri, 13 Nov 1992 18:44:21 GMT
  9. Lines: 21
  10.  
  11. ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
  12.  
  13. >I would like to know what the standard says about the following program:
  14.  
  15. [ writes the contents of a pointer with fwrite, reads it back with fread ]
  16.  
  17. >What I want to know is whether, assuming nothing else goes wrong, the
  18. >program _must_ print 1 or whether it may print 0.
  19.  
  20. [ that is, whether the value read == the value written ]
  21.  
  22. ANSI C Standard 4.9.2:
  23.  
  24. "Data read in from a binary stream shall compare equal to the data that
  25. were earlier written out to the stream, under the same implementation."
  26.  
  27. In the example, the file was opened in binary mode, so this applies.
  28. -- 
  29.  
  30. Steve Clamage, TauMetric Corp, steve@taumet.com
  31. Vice Chair, ANSI C++ Committee, X3J16
  32.