Convert a char to upper case
Posted on 1998-11-01
What is the best way to make a char variable upper case? It's not that hard when I have a string (MakeUpper() is built in to CString). But it's different with just a char.
And got the error
error C2120: 'void' illegal with all types
I could convert the char to a CString temporarily, convert its case, and change it back to a char. But that is inefficient, involves too many steps, and uses a temporary variable.
I can't use _strupr because it expects char *:
error C2664: '_strupr' : cannot convert parameter 1 from 'char' to 'char *' (new behavior; please see help)
How about CharUpper(charCurrent)? The documentation says lpsz can be "single character or pointer to string". But it doesn't seem to work with my single character:
error C2664: 'CharUpperA' : cannot convert parameter 1 from 'char' to 'char *' (new behavior; please see help)
It's like it expects a string (char *). Am I doing some thing wrong?
(Visual C++ 4.0)