How exactly do I read a QString from a file outside of Qt? The file stores map data for my game I'm writing in Visual Studio. right now I'm simply trying to read the header that I wrote to the file first.
I'm using QDataStream to write it:
qint32 version = 0;
out << HeaderId << version;
QString HeaderId("SME");
qint32 version = 0;
out << HeaderId << version;
To copy to clipboard, switch view to plain text mode
I read in the reference that a QString is written as a qint32 so I tried to read it like this:
int32 HeaderId[3];
int32 HeaderVersion;
fread( &HeaderId, sizeof( int32), sizeof(HeaderId), file);
fread( &HeaderVersion, sizeof( int32), 1, file);
int32 HeaderId[3];
int32 HeaderVersion;
fread( &HeaderId, sizeof( int32), sizeof(HeaderId), file);
fread( &HeaderVersion, sizeof( int32), 1, file);
To copy to clipboard, switch view to plain text mode
I'm getting a unhandled exception when it tries to read the version. How do I do this right?
Bookmarks