alok9871
21st March 2013, 03:20
Hi
I wish to write something onto a data file. I thought of using QDataStream, but it tens to give me wrong output.
QFile file("file.dat");
file.open(QIODevice::WriteOnly);
QDataStream out(&file);
out.setByteOrder(QDataStream::LittleEndian);
//out << QString("the answer is"); // serialize a string
int x = 54;
out << (qint32)x;
out.device()->close();
I was expecting an output of 54. Itself it shouwing me its char value = 6; even with other numbers.
Please let me know how to address this problem
Thanks
Regards
Alok
I wish to write something onto a data file. I thought of using QDataStream, but it tens to give me wrong output.
QFile file("file.dat");
file.open(QIODevice::WriteOnly);
QDataStream out(&file);
out.setByteOrder(QDataStream::LittleEndian);
//out << QString("the answer is"); // serialize a string
int x = 54;
out << (qint32)x;
out.device()->close();
I was expecting an output of 54. Itself it shouwing me its char value = 6; even with other numbers.
Please let me know how to address this problem
Thanks
Regards
Alok