Internationalization and localization tools


ANSI Error Message Function

char *strerror_r(int errnum, char *buf, size_t n);

Internationalization (I18n) Function Overview

The strerror_r function works like strerror but instead of returning the error message in a statically allocated buffer shared by all threads in the process, it returns a private copy for the thread. This might be either some permanent global data or a message string in the user supplied buffer starting at buf with the length of n bytes. This ability makes strerror_r a re-entrant function.

I18n Issues

This function 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, its worth noting that in some limited instances it still may be useful. For example, for debugging, or for writing to log files that will not be viewed by the end user.

Special care must be taken with the size parameter. See Locale-Sensitive Length Functions for a complete discussion of the issues involved with functions that pass length parameters.

There is no ANSI wide character version of this function. The return value will need to be converted from multibyte UTF-8 characters to wide characters after the call.

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

ANSI Error Message Functions

 

Lingoport internationalization and localization services and software