views:

49

answers:

1

I have the following string in notepad "ùŒÚÿwž+2»ó66H".

I used the fstream library to read those files in c++ and print those characters and thier equivalent decimal numbers in the conlsole window but the symbols are different than those in notepad and numbers for the extended characters are in negative form,i realize maybe its impossible for my console window to print those symbols as the vary through many character sets but how do i get the numbers displayed as 255 and not -1 ??

+3  A: 

Simple version: Read the file as unsigned char instead of char and use printf('%c', a) to see what character you get. This will get you values between 0 to 255 and not -128 to 127

shoosh