S
sri
I think the following question is related to this group that is why I
am posting
The question is:
I am reading bytes from binary file. At a particular position the byte
value is "FF".
I am reading the byte as follows :
std::basic_ifstream<unsigned char> in("somefile.bin",std::ios::in |
std::ios::binary);
unsigned int wData = 0;
unsigned long wPosition = 0x1C8L;
in.seekg(wPosition,std::ios::beg);
//the following statement gives wData value is zero instead "FF"
//read operation is failing
in.read(reinterpret_cast<unsigned char*>(&wData),1);
//but following statement gives wData value is "FF"
in.read(reinterpret_cast<char*>(&wData),1);
what is going wrong?
With Regards,
Sri.
am posting
The question is:
I am reading bytes from binary file. At a particular position the byte
value is "FF".
I am reading the byte as follows :
std::basic_ifstream<unsigned char> in("somefile.bin",std::ios::in |
std::ios::binary);
unsigned int wData = 0;
unsigned long wPosition = 0x1C8L;
in.seekg(wPosition,std::ios::beg);
//the following statement gives wData value is zero instead "FF"
//read operation is failing
in.read(reinterpret_cast<unsigned char*>(&wData),1);
//but following statement gives wData value is "FF"
in.read(reinterpret_cast<char*>(&wData),1);
what is going wrong?
With Regards,
Sri.