Hi All,
I am very new to Qt and C++ programming in general and have got into some difficulty.
I am trying to read data from a very large binary file (upto 1GB in size) but I keep having problems.
I would like to read a certain number of bytes into a struct using QDataStream. I can compile and run the code with no errors, but it is not reading in the data that I expect.
Here is a simplified version of the code:
Qt Code:
SomeStructure *someStruct; fileStream.readRawData(reinterpret_cast<char*>&someStruct, someByteSize);To copy to clipboard, switch view to plain text mode
I cannot read all the data in at once due to the size of file and would like the ability to move through the data that QDataStream gives.
I can get this to work using the ifstream, however this appears to be causing a memory issue a few lines later that I cannot correct. Therefore I thought it better to try the Qt functions for file reading.
If anyone can help then I would be so grateful! as this issue has been driving me mad!
Many Thanks
Bookmarks