String Operation Function
void perror(const char *string);
void _wperror(const wchar_t *string);
void _tperror(const TCHAR *string);
Internationalization (I18n) Function Overview
The perror function prints the error message string , along with a
system error message for the last library call that produced an error, to stderr .
If string is null, the function prints only the system error message.
If string is not null, then perror prints a string containing the passed in string message followed by a colon, a space,
the system error message, and a newline character.
To produce accurate results, call perror immediately after a library routine
returns with an error. This is because the system error message is based on the error value is stored in the global variable errno ,
which may be overwritten by subsequent library calls.
_wperror is the wide-character version of the function; its parameters and return value are wide characters. _wperror is supported on Windows platforms only. There is no wide version on ANSI platforms.
_tperror is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either perror or _wperror .
I18n Issues
These functions should not be relied upon to print error messages in any language other
than English, and therefore should be avoided in an internationalized application.
However, it's worth noting that in some limited instances they still may be useful. For example,
for debugging, or for writing to log files that will not be viewed by the end user.
There is no ANSI wide character version of this function. The parameters will have to be converted to multibyte UTF-8 characters and then the perror function can be used.
Recommended Function Replacements
Locale-Sensitive C/C++ String Operation Functions
|