Convert char from filestream to lowercase..?

Hi all,

Please read before posting:

I'm taking data from a ifstream filestream (that's reading from a .txt file) and placing it into a char variable.

Then, char-by-char I'm placing those letters/numbers/punctuation into a char array.

What I'm trying to do is effectively convert any UPPERCASE letters from that ifstream to lowercase before they get saved into the char array.

I've tried

tolower(currentChar);

but it doesn't seem to have any effect whatsoever. The final array is still populated with some uppercase characters.

Any ideas how to convert the currently handled character to lower-case before I place it into the final char array?
Last edited on
tolower(currentChar);

That doesn't change currentChar. It's a function call that returns a whole new char, that is lower case.

So used like this:
char newChar = tolower(currentChar); newChar will be what you want.
Registered users can post here. Sign in or register to post.