I’m trying to read a character represented by the hex value 0x80 from a file and then when writing to another file, ignore this character. However, if I check this character with a simple command, such as:
if(int(c1) == 0x80)
str += "";
The character still ends up written to the string and eventually written to my file. I’ve done a little bit of research and I think it may have something to do with signed/unsigned characters and Microsoft Visual C++ 2008 using signed character, putting 0x80 outside the bounds. When I insert breakpoints into my program when I know a variable contains this character and mouseover it tells me the value of the character is 0. I’m now sure what this means, but when I started using it as a test c1 == 0 it still ends up writing the character to the file. Oddly enough it shows up as a block character 0x80 in Notepad++ instead of the Euro sign (how it shows up in the input and output files when its not caught. Any idea what’s going on?
As you surmised, it’s probably sign-extending the number. This might work: