Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
perror - write error messages to standard error
&pagelevel(4)&pagelevel
Syntax | #include <stdio.h> void perror(const char *s); |
Description | perror() maps the error code in the external variable errno to a language-dependent error_message, which is written to the standard error stream as follows:
s : error_message \n s is a string that should include at least the name of the program in which the error occurred. If s is a null pointer or the character to which s points is a null byte, the message portion is omitted (" s : " ). The contents of the error message strings depend on the environment variable LANG . All error codes and error messages are listed and explained in the header errno.h . perror() will mark the file associated with the standard error stream as having been written (st_ctime , st_mtime marked for update) at some time between its successful completion and a call to exit() , abort() , or the completion of fflush() or fclose() on
stderr .
|
Notes | The contents of the area in which the error code and error text are stored are not explicitly deleted, i.e. the previous contents are retained until they are overwritten with appropriate information when a fresh error occurs. perror calls are therefore only useful after a function has provided an error return value. The program environment determines whether perror() is executed for a BS2000 or POSIX file. The message text output can also contain inserts for POSIX error messages. BS2000 In the case of I/O errors or when system commands are executed, error_message contains the appropriate DMS error codes as supplementary information. In KR mode (only available with C/C++ versions lower than V3), a value of type char * is returned. It contains a pointer to an internal C buffer with the error message. The contents are overwritten at each new call to perror (see also the manual "C Library Functions" [6 (Related publications)]). If the program is called in a BS2000 environment and the file does not exist, the following error message is printed on standard output: Program fopen: dataset not found (cmd: OPEN), errorcode=DD33
DD33 is the DMS error code. (End) |
See also | strerror() , errno.h , stdio.h , section “Selecting functionality”.
|