Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Need Help Reading a Binary File
I've problem reading a binary file, however it's successful in reading non-binary files such as text/wri files.
Specifically, the buffer reads NULL bytes and gives me ASSERT(lpBuf != NULL) from filecore.cpp, line 243. But, why is this just happening for binary files and not for the non-binary ones? I've tried the c runtime function fread() and it fails on the 2nd attempt of the loop yielding some 9 odd bytes of read bytes even when reading large files (400kb).
This is the code:
CFile pFile (sFilename, CFile::modeRead);
int iReadSize = 0;
iReadSize = pFile.Read(pBuf, 4096);
if(iReadSize == 0)
//my processing goes here
Any suggestions please?
0 · ·