I want to read the content of a binary file which does not work correctly using the read method of istream because it stops reading at the first '0' byte encountered.
Using rdbuf() seems to avoid that problem but I read that it is not a very efficient way to do it.
ifstream::read does not stop at the first 0 byte. There must be something wrong with your code. Or did you mean the >> operator?
If no, you should post some code.
You're right the read() function doesn't stop reading at the first 0 byte.
My problem was the way I assigned the value of the character array filled by the read() function to a string. Example: