6.24.19 towlower Function

Convert a wide character to a lowercase alphabetical wide character.

Attention: This function is implemented only by MPLAB XC32 C compilers.

Include

<wctype.h>

Prototype

int towlower(wint_t wc);

Argument

wc
The wide character to convert.

Return Value

Returns the corresponding lowercase alphabetical wide character if the argument, wc, was originally uppercase; otherwise, returns the original wide character.

Remarks

Only uppercase alphabetical wide characters may be converted to lowercase.

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 lower case: ");
	do {
		wc = wStr[idx];
		putwchar(towlower(wc));
		idx++;
	} while(wStr[idx]);
	printf("\n");
}

Example Output

String in lower case: a string, 2 wide 4 some.