qc.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
strerror, _strerror
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     The strerror function maps <errnum> to an error-message string,
     returning a pointer to the string. The function itself does not
     actually print the message; for that, you need to call an output
     function (such as printf).
 
     If <string> is passed as NULL, _strerror returns a pointer to a
     string containing the system error message for the last library
     call that produced an error. The error-message string is
     terminated by the newline character (\n).
 
     If <string> is not equal to NULL, _strerror returns a pointer to a
     string containing, in order, your string message, a colon, a
     space, the system error message for the last library call
     producing an error, and a newline character. Your string message
     can be a maximum of 94 bytes long.
 
     Unlike perror, _strerror alone does not print any messages. To
     print the message returned by _strerror to stderr, your program
     needs an fprintf statement, as shown below:
 
          if( ( access( "datafile", 2 ) ) == -1 )
               fprintf( _strerror( NULL ) );
 
     The actual error number for _strerror is stored in the errno
     variable, which is declared in STDLIB.H. The system error messages
     are accessed through the variable sys_errlist, which is an array
     of messages ordered by error number. The _strerror function
     accesses the appropriate error message by using the errno value as
     an index to sys_errlist. The value of the variable sys_nerr is
     defined as the maximum number of elements in the sys_errlist
     array.
 
     To produce accurate results, _strerror should be called
     immediately after a library routine returns an error. Otherwise,
     the errno value may be overwritten by subsequent calls.
 
     Return Value
 
     The strerror function returns a pointer to the error-message
     string. The string can be overwritten by subsequent calls to
     strerror.
 
     The _strerror function returns no value.
                                    -♦-