PDA

View Full Version : How can I read Binary files with Qt



geo_saleh
12th August 2007, 18:50
Hi

how Can I read Binary File with Qt "QDataStream ()"

what I want is the code witch reading the binary files Byte by Byte



thanks,

marcel
12th August 2007, 19:13
The code is fairly easy.
You have to use QDataStream::readRawBytes(const char*, int).

The QDataStream has to be initialized with a QIODevice, either in the constructor or with setDevice. You will have to pass an opened QFile here.

But I don't suggest reading the data byte by byte, because it will take longer.
You can read it in a buffer, and process it separately.

Regards

geo_saleh
16th August 2007, 11:37
thanks very much :)