why fstream.read work and not >>?
c++, fstream
Solution
Apparently you're reading a binary file. The `read` command literally copies the requested number bytes from the file into the memory indicated by pointer you provided. The `>>` operator expects to find ASCII text to be converted into an integer. The two operations simply aren't the same.
Problem
I'm wondering why i cannot use the `>>` operator of an `std::ifstream` to read an unsigned int from a binary file. ``` #include <fstream> int main(int argc, char* argv[]) { std::ifstream in(argv[1]); if(in.fail()) return -1; unsigned int atom_size = 0; in.read(reinterpret_cast<char*>(&atom_size), 4); in >> atom_size; return 0; } ``` When I use `in.read` I get the value that I wanted, but when I use the `>>` operator my atom_size variable doesn't change. Why ?