[Qt-interest] how to write data into file
Vincent Cai
wcai at cypress.com
Tue Oct 11 14:35:57 CEST 2011
Dear all,
I try to write some different type of data into a file, but failed.
From below code, what I hope to get in file is: 01 00 02 00 00 00 03
But what I exactly get is: 123
Could anybody tell me how to modify below code?
QFile TSAFile;
QString tmp;
const QChar *data;
quint8 a = 0x01;
quint16 b = 0x02;
quint32 c = 0x03;
tmp += QString::number(a, 16);
tmp += QString::number(b, 16);
tmp += QString::number(c, 16);
data = tmp.constData();
while (!data->isNull())
{
TSAFile.write((char*)data);
++data;
}
TSAFile.setFileName("C:\\QtDebug.bin");
TSAFile.close();
Thanks,
Vincent.
________________________________
This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111011/b3b4cc78/attachment.html
More information about the Qt-interest-old
mailing list