I was attempting to read a binary file byte by byte using an ifstream. I\'ve used istream methods like get() before to read entire chunks of a binary file at once without a
The >> extractors are for formatted input; they skip white space (by
default). For single character unformatted input, you can use
istream::get() (returns an int
, either EOF if the read fails, or
a value in the range [0,UCHAR_MAX]) or istream::get(char&)
(puts the
character read in the argument, returns something which converts to
bool
, true if the read succeeds, and false if it fails.