Maps the error number in error_code to a locale-dependent error message string.
#include <string.h> char *strerror (int error_code); (ANSI C) char *strerror (int error_code[, int vms_error_code]); (DEC C Extension)
When a program is not compiled with any standards-related feature- test macros (see Section 1.5.1), strerror has a second argument (vms_error_code), which is used in the following way:
See the strerror example.
Use of the second argument is not included in the ANSI C definition of strerror and is, therefore, not portable.
Because no return value is reserved to indicate an error, applications should set the value of errno to 0, call strerror, and then test the value of errno; a nonzero value indicates an error condition.
x | A pointer to a buffer containing the appropriate error message. Do not modify this buffer in your programs. Moreover, calls to the strerror function may overwrite this buffer with a new message. |
#include <stdio.h> #include <errno.h> #include <string.h> #include <stdlib.h> #include <ssdef.h> main() { puts( strerror (EVMSERR) ); errno = EVMSERR; vaxc$errno = SS$_LINKEXIT; puts( strerror (errno) ); puts( strerror (EVMSERR, SS$_ABORT ) ); exit(1); }
Running this example produces the following output:
non-translatable vms error code: <none> network partner exited abort