Public Comment Number PC-UK0093 ISO/IEC CD 9899 (SC22N2620) Public Comment =========================================== Date: 1998-02-25 Author: N.M Maclaren Author Affiliation: Self Postal Address: University of Cambridge, Computer Laboratory, New Museums Site, Pembroke Street, Cambridge CB3 3QG, United Kingdom E-mail Address: Telephone Number: +44 1223 334761 Fax Number: +44 1223 334679 Number of individual comments: 1 Comment 1. Category: Feature that should be included Committee Draft subsection: 7.13.10 Title: I/O error diagnosis function Detailed description: One of the worst aspects of programs written in standard C is that application diagnostics are so poor, which is partly because of the requirement for all of them to be mapped into a single integer error code, and then back to text. Many systems can provide much more information, and a standard function is needed so that portable applications can make use of that. By far the most important area is I/O, so I suggest adding the function: 7.13.10.5 The ioerror function Synopsis 1 #include char *ioerror(FILE *stream) Description 2 The ioerror function maps the error state of the stream to a message string. The string may contain newline characters, may include information that is not simply a description of the reason for the failure, and apparently identical error states may map to different strings. 3 The implementation shall behave as if no library function calls the ioerror function. Returns 4 The ioerror function returns a pointer to the string if the error flag is set for the stream. If the error flag is not set for the stream, it is unspecified whether a null pointer, an empty string or some informative text is returned. The array pointed to shall not be modified by the program, but may be overwritten by a subsequent call to the ioerror function. [ Note that I have left the message unspecified rather than implementation defined, because the main object is to get away from fixed error messages and allow the inclusion of dynamic data. Requiring implementation definition would discourage this, because the message will often be received from another system component (e.g. a socket library) and hence be unknown to the C run-time system. I have implemented the above specification, and can hence claim prior art! ]