Important read:
http://www.cplusplus.com/forum/beginner/14081/#msg68655
[edit]
FORGET THE REST OF THE CRUFT IN THIS THREAD
People here are just messing around now. Use the method I give in the link if you want to convert a string to upper case. (Presuming locale-sensitive applications aside.)
filipe's
std::
for_each() throws away the result (and
s remains unchanged)
joeneldeasis's
strupr() is non-standard, and not C++
rocketboy9000 and
PiMaster's loopy code is, well, not (NOT BY LOOP). (Also, it doesn't work right for things like 'á', where
std::
toupper()
should... presuming your locale is properly set. (BTW, you don't need to test whether or not it is already upper before conversion. The function returns the argument character if no change is necessary.)
ne555 knows what he is doing, but a regular expression is totally overkill here -- in any case
sed != C++, and he is just messing with you.
The link I gave you gives you working, standard code that will do the job, jumping all the right hoops to work on all modern C++ compilers. Don't let people side-track you.
[/edit]