Internationalization and localization tools


Locale-Sensitive C/C++ String Operation Function

char *getenv(const char* varname);

wchar_t *_wgetenv(const wchar_t* varname);

TCHAR *_tgetenv(const TCHAR* varname);

Internationalization (I18n) Function Overview

The getenv function returns a pointer to the environment table entry containing varname, or NULL if varname is not found. On Windows, the match is case-insensitive, treating lowercase characters as if they were uppercase.

Only Windows platforms supply a wide-character version of this call - _wgetenv. The argument and return value are both wide-character strings.

_tgetenv is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either getenv or _wgetenv.

I18n Issues

Use the appropriate version of the function as required for internationalization support, noting the following:

On ANSI platforms, there is no corresponding wide function call. Instead, use string conversion routines and call getenv.

For Windows MBCS support, ensure that the multibyte code page is set properly, as getenv depends on it. By default, the multibyte code page is set to the system-default ANSI code page obtained from the operating system at program startup. Use _getmbcp and _setmbcp to query or change the current multibyte code page, respectively.

Recommended Replacements*

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

Locale-Sensitive C/C++ String Operation Functions

 

Lingoport internationalization and localization services and software