View Full Version : How can I read binary data to QString?
zolookas
29th July 2008, 17:07
Can I read binary data (for example 9 bytes) directly to QString from file? fread does not work with QString for me (requires char*), QDataStream also requires char* and serialized data example (http://doc.trolltech.com/4.3/qdatastream.html) does not appear to be sutable for binary data.
How about using QDataStream::readRawData()?
http://doc.trolltech.com/4.3/qdatastream.html#raw
edit: Nevermind, I misread your post. Sorry...
Can you use QString::data() and cast that (QChar) pointer to a regular char* ?
QByteArray is the appropriate class are when you need to store raw binary data.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.