Hi all! I was making some little application that needed to convert some chars into others, just so a txt file seems unreadable... But I got some reeeallly wierd problem, I can go around it and make things work fine, but I get this strange problem:
I have in my program an "unsigned char" buffer that I use to read on a file an check to see if the char is equal to something and then I do something with it. Somewhere I have that piece of code:
So there I believe I'm having a compiler error. I expect my program to "do something" when the read buffer is equal to the unsigned char '¤' value, or 164... But it never works. If I use the debugger and check what is "(buffer == '¤')" while buffer is supposed to be 164 (¤), it tells me its true (one would hope), but then the code-cursor don't get to the "do something" line and instead it goes inside the "else"... I think that's totally wierd, I use MSVC++ 2003, and I don't see why something that is true could be seen as false...Code:iFile >> buffer; //Where iFile is an "ifstream" and "buffer" the char... if (buffer == '¤') //do something... else //...
But I found out that if I wrote:
it would work... Though these are supposed to be equal (¤ == 164)...Code:if (buffer == 164) //instead of if (buffer == '¤')
Any idea why this would do something like that?