#include <wchar.h>
|
void
wperror (const wchar_t *string); |
#include <wchar.h>
|
wchar_t *
wcserror (int errnum); |
The function wcserror function accepts an error number argument errnum (error number) and returns a pointer to the corresponding message string.
The function wperror finds the error message corresponding to the current value of the global variable errno and writes it, followed by a newline, to the standard error file descriptor. If the argument string is non- NULL and does not point to the null character, this wide char string is prepended to the message string and separated from it by a colon and space (": "); otherwise, only the error message string is printed.
If the error number is not recognized, these functions return an error message string containing "Unknown error: " followed by the error number in decimal. The wcserror function returns EINVAL as a warning. Error numbers recognized by this implementation fall in the range 0 < errnum < sys_nerr.
If insufficient storage is provided in strerrbuf (as specified in buflen) to contain the error string, wcserror returns ERANGE and strerrbuf will contain an error message that has been truncated and NUL terminated to fit the length specified by buflen.
#include <string.h> #include <stdio.h> #include <errno.h> #include <wchar.h> int main() { wchar_t *ptr = wcserror(ERANGE); wprintf(L"wcserror(ERANGE) = %s\n",ptr); return 0; }
Output
wcserror(ERANGE) = Numerical result out of range
The return type for wcserror is missing a type-qualifier. The type-qualifier must be const wchar_t * .
© 2005-2007 Nokia |