Long program short: I am reading binary file byte by byte and after each read byte I output this byte but not as a character( as I declared a variable char c
and store the values in that ) but as int
. When I come to binary values around 125 above I get values negative values.
For example when I read hex 89
= dec 137
and I output this char as int
, I get value -119
.
Another example: I read hex 83
= dec 131
and I output this char as int
, I get value -125
.
I read this file by bytes:
ifstream inFile;
inFile . open( srcName, ios::binary | ios::in );
char c;
while( inFile . get( c ) ){
inFile . get( c );
cout << (int) c << endl;
}