Unsigned char IO
| Mayflower (25) | |
1 2 3 4 5
|
ifstream in;
in.open(filename, ios::binary);
unsigned char c;
in.get(c); |
The basic file input as listed in the tutorial will not accept unsigned chars, only chars or char*.
Help? |
|
| Zaita (1562) | |
in.get(&c); ? |
Last edited on | |
|
| Mayflower (25) | |
| Sadly, &c doesn't work, should i make c an unsigned char * ? |
|
| Duoas (1595) | |
That is a peculiarity of C and C++: char is distinct from both unsigned char and signed char. Just cheat with a little typecast.
1 2
|
unsigned char c;
in.get( (char)c ); |
That will still work properly. |
|
This topic is archived - New replies not allowed.