R
Roncohl
So I'm trying to read some data from a file, which includes hex numbers
of a known length (In my specific case, 6). I know there are more
indirect ways to do this, but I was hoping I could do it more directly.
For example, I want to read in the first 6 characters in this string as
a hex number:
0000FF123456
I was hoping I could do something along the lines of
int x;
ifstream file;
// Open the file, etc.
file >> setw(6) >> x;
The problem is, it ignores the 0s - x will have the value 0xFF1234
(Instead of 0x0000FF, like I want).
Is there a way around this, or am I going to have to find a less direct
way?
Thanks.
of a known length (In my specific case, 6). I know there are more
indirect ways to do this, but I was hoping I could do it more directly.
For example, I want to read in the first 6 characters in this string as
a hex number:
0000FF123456
I was hoping I could do something along the lines of
int x;
ifstream file;
// Open the file, etc.
file >> setw(6) >> x;
The problem is, it ignores the 0s - x will have the value 0xFF1234
(Instead of 0x0000FF, like I want).
Is there a way around this, or am I going to have to find a less direct
way?
Thanks.