_strupr, _strupr_l, _mbsupr, _mbsupr_l, _wcsupr_l, _wcsupr
Convert a string to uppercase. These functions are deprecated because more secure versions are available; see _strupr_s, _strupr_s_l, _mbsupr_s, _mbsupr_s_l, _wcsupr_s, _wcsupr_s_l.
char *_strupr( char *str ); wchar_t *_wcsupr( wchar_t *str ); unsigned char *_mbsupr( unsigned char *str ); char *_strupr_l( char *str, _locale_t locale ); wchar_t *_wcsupr_l( wchar_t *str, _locale_t locale ); unsigned char *_mbsupr_l( unsigned char *str, _locale_t locale ); template <size_t size> char *_strupr( char (&str)[size] ); // C++ only template <size_t size> wchar_t *_wcsupr( wchar_t (&str)[size] ); // C++ only template <size_t size> unsigned char *_mbsupr( unsigned char (&str)[size] ); // C++ only template <size_t size> char *_strupr_l( char (&str)[size], _locale_t locale ); // C++ only template <size_t size> wchar_t *_wcsupr_l( wchar_t (&str)[size], _locale_t locale ); // C++ only template <size_t size> unsigned char *_mbsupr_l( unsigned char (&str)[size], _locale_t locale ); // C++ only
Parameters
- str
-
String to capitalize.
- locale
-
The locale to use.
The _strupr function converts, in place, each lowercase letter in str to uppercase. The conversion is determined by the LC_CTYPE category setting of the locale. Other characters are not affected. For more information on LC_CTYPE, see setlocale. The versions of these functions without the _l suffix use the current locale; the versions with the _l suffix are identical except that they use the locale passed in instead.
_wcsupr and _mbsupr are wide-character and multibyte-character versions of _strupr. The argument and return value of _wcsupr are wide-character strings; those of _mbsupr are multibyte-character strings. These three functions behave identically otherwise.
If str is a null pointer, the invalid parameter handler is invoked, as described in Parameter Validation . If execution is allowed to continue, these functions return the original string and set errno to EINVAL.
In C++, these functions have template overloads that invoke the newer, secure counterparts of these functions. For more information, see Secure Template Overloads.
| TCHAR.H routine | _UNICODE & _MBCS not defined | _MBCS defined | _UNICODE defined |
|---|---|---|---|
| _tcsupr | _strupr | _mbsupr | _wcsupr |
| _tcsupr_l | _strupr_l | _mbsupr_l | _wcsupr_l |
| Routine | Required header | Compatibility |
|---|---|---|
| _strupr, _strupr_l | <string.h> | Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 |
| _wcsupr, _wcsupr_l | <string.h> or <wchar.h> | Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 |
| _mbsupr, _mbsupr_l | <mbstring.h> | Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 |
For additional compatibility information, see Compatibility in the Introduction.