Click here to Skip to main content
15,922,407 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Documentation located here :


http://msdn.microsoft.com/en-us/library/windows/desktop/ms647467(v=vs.85).aspx

says the function can convert single char, but each time I call the function with single char I always get a compile time error stating that a string is required.

Please can someone show me a line of code that illustrate how these functions are used to convert characters?
Posted
Updated 16-Mar-18 20:24pm

Look at the description:

"A null-terminated string, or specifies a single character. If the high-order word of this parameter is zero, the low-order word must contain a single character to be converted."
So all you have to do is:
C++
...  CharLower((LPTSTR) 'A');
 
Share this answer
 
Comments
Gbenbam 18-Feb-14 10:33am    
Believe me, I have read that billion times and never really understood it.Thanks a lot
OriginalGriff 18-Feb-14 10:34am    
You're welcome!
I was also recently baffled by the documentation about this issue, here are the two versions of this function, note that this is a way of changing letters without directly using the crt.

C++
wchar_t nCharUpperW = LOWORD((DWORD)CharUpperW((LPWSTR)L'ñ'));
char nCharUpperA = LOBYTE(LOWORD((DWORD)CharUpperA((LPSTR)(WORD)'ñ')));

wchar_t nCharLowerW = LOWORD((DWORD)CharLowerW((LPWSTR)L'Ñ'));
char nCharLowerA = LOBYTE(LOWORD((DWORD)CharLowerA((LPSTR)(WORD)'Ñ')));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900