I'm trying to read a file with ifstream:
std::ifstream is("sample_freeway.h264", std::ifstream::binary);
std::cout << "reading" << std::endl;
if (is)
{
while (!is.eof() || !is.fail() || !is.bad())
{
auto buffer = std::make_shared<SimpleEncodedPacket>();
is.read(reinterpret_cast<char *>(buffer->getFramePointer()), buffer->getSize());
}
std::cout << std::endl;
} else {
std::cout << "could not open file" << std::endl;
}
but the while
keeps going forever, even though the file is super small. It should finish almost instantly. What am I doing wrong?