Hai
I have a binary file I want to read that
either I have to use QBitArray or ByteArray ... DataStream
pl help me
Hai
I have a binary file I want to read that
either I have to use QBitArray or ByteArray ... DataStream
pl help me
If you want to access data bit by bit. For various binary operations. You should use QBitArray.
Otherwise QByteArray and QDataStream will work.
Hai
that binary file in LittleEndian format
what to do?
pl give some example..
The QDataStream class provides serialization of binary data to a QIODevice.
A data stream is a binary stream of encoded information which is 100% independent of the host computer's operating system, CPU or byte order
Qt Code:
QString str; qint32 a; in >> str >> a; // extract "the answer is" and 42To copy to clipboard, switch view to plain text mode
hai
i tried with QDataStream and QByteArray. but the data is empty...
Qt Code:
QByteArray buffer; { return; } buffer=fileA.readAll(); qDebug()<<buffer.data(); qDebug()<<buffer.size();To copy to clipboard, switch view to plain text mode
output
206368
Last edited by wysota; 17th July 2009 at 20:10. Reason: missing [code] tags
dont use buffer.data() in qDebug... just use buffer... because a zero may terminate the char* at any point..
Hai
thanks for ur reply
actually that is binary file .
I want to read the data
how to get the datas?
every binary file has a format... do you have the format (struct etc)..?
yes I have that program and format
then just go simple.. nad read the data as it was written in that program..
it must be written as
FILE* fp
fwrite(struct* ,fp);
so read it that way only..
FILE* fp
fread();...
Thanks to all
I got solution.
Bookmarks