I created function Qt to read in a binary file, and it works.
[code]
if (fileLoad.open(QIODevice::ReadOnly))
{
QDataStream in(&fileLoad);
quint8 Variable_8bits;
quint16 Variable_16bits;
quint32 Variable_32bits;
in >> Variable_16bits >> Variable_8bits >> Variable_32bits >> ZeroByte;
qDebug() << Variable_16bits << Variable_8bits << Variable_32bits;
//Works no extreme conversion necessary as i read input with "set size variables"
// first 16bits, then 8bits, then 32bits
// and store it correctly for display
}
fileLoad.close();
}
So basically I could read in a binary file, using variables of different sizes to access the values in the file (Since I know the format of file structure)
My issue is that, now I need to create the same or similar functionality to a standard c++ function.
Is there a DataStream like Qt for C++ Or do I have to manually load file into buffer, then read in individual bytes, do bitwise manipulations to get the correct representation length, before i display the value or if there is a simpler method...
whats the way forward...
I would use std::ifstream for this simple use case presented as follows below.
However, note that the 8, 16, and 32 bit types were only added to the standard in C++11 and on.