Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ifstream can't read 0x09

Status
Not open for further replies.

horst123

Programmer
Mar 21, 2005
18
DE
Hi,

I try to read from a binary file. Everthing goes well, but if i try to read a 09 he replaces it with 00.

Can anybody explain this to me?


thx
 
Okay, I write something more, so that you understand my problem:

i try to read in unsigned char from a file like that
Code:
ifstream confdat(file);
confdat >> iList.i_time_8;

All goes well, but if i try to read in any hex code from 0x09 to 0x0D i get data trash...
 
solved it with iList.i_time_8 = confdat.get();
 
Be careful: operator >>(char) ignores all whitespaces (isspace(c) != 0) in text and binary stream modes (i.e. in all cases).
isspace(c) != 0 for c in 9..13 range.
Use f.get(c) in that case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top