I need to read in bytes and I can't get this to work:
unsigned char ascii;
while(cin.get(ascii))
{
...
}
I tried to static_cast<char>(ascii) but that didn't work. Anyone know the problem?
UPDATE:
I am trying to read 8-bit characters.
I tried static casting because I just wanted the get() to work even though it was counter intuitive.
while(ascii = cin.get())
Causes an infinite loop, not sure how to fix.
Last edited on
Define "byte". Are you reading hex bytes? Characters?
Why, if your question is how to read an unsigned char, are you
attempting to static cast to (signed) char?
I believe that some architectures (like M68000) don't allow you to mix pointers to signed/unsigned.