6.24.20 towupper Function
Convert a wide character to an uppercase alphabetical wide character.
Include
<wctype.h>
Prototype
int towupper(wint_t wc);
Argument
-
wc
- The wide character to convert.
Return Value
Returns the corresponding uppercase alphabetical wide character if the argument,
wc
, was originally lowercase; otherwise, returns the original wide
character.
Remarks
Only lowercase alphabetical wide characters may be converted to uppercase.
Example
See the notes at the beginning of this chapter or section for
information on using printf()
or scanf()
(and other functions reading and writing the stdin
or
stdout
streams) in the example code.
#include <wctype.h>
#include <wchar.h>
#include <stdio.h>
int main(void)
{
wchar_t wStr[] = L"A string, 2 wide 4 some.\n";
wint_t wc;
unsigned idx = 0;
printf("String in upper case: ");
do {
wc = wStr[idx];
putwchar(towupper(wc));
idx++;
} while(wStr[idx]);
printf("\n");
}
Example Output
String in upper case: A STRING, 2 WIDE 4 SOME.