Public Comment Number PC-UK0278 ISO/IEC CD2 9899 (SC22N2794) Public Comment =========================================== Date: 1998-12-12 Author: C.D.W.Feather Author Affiliation: Self Postal Address: Demon Internet Ltd. 322 Regents Park Road London N3 2QQ United Kingdom E-mail Address: Telephone Number: +44 181 371 1138 Fax Number: +44 181 371 1037 Category: Request for information/clarification Committee Draft subsection: 7.19.8.1, 7.19.8.2 Title: Clarify the actions of fread and fwrite Detailed description: The exact behaviour of fread and fwrite are not well specified, particularly on text streams but in actuality even on binary streams. For example, the wording does not require the bytes of the object to be output in the order they appear in memory, but would allow (for example) byte-swapping. It is reported that at least one implementation converts to a text form such as uuencoding on output to a text stream, converting back on input. And, finally, there is not even a requirement that data written out by fwrite and read back by an equivalent call to fread even has the same value. These changes apply the obvious semantics. In 7.19.8.1p2, add after the first sentence: For each object, /size/ calls are made to the /fgetc/ function and the results stored, in the order read, in an array of /unsigned char/ exactly overlaying the object. In 7.19.8.2p2, add after the first sentence: For each object, /size/ calls are made to the /fputc/ function, taking the values (in order) from an array of /unsigned char/ exactly overlaying the object.