[Qt-interest] Write struct in a QByteArray or QFile

Tiago Correia tiago at cnotinfor.pt
Mon Jun 8 14:44:25 CEST 2009


Hi,
I'm trying to write my own struct to a file. I'm trying to use QFile, but
I'm getting the correct data.

I've tried this, but it seems that the header of the file (my struct) is not
ok.

Here is my struct

#pragma pack (push,1)
typedef struct
 {
char szRIFF[4];
 long lRIFFSize;
char szWave[4];
 char szFmt[4];
long lFmtSize;
 WAVEFORMATEX wfex;
char szData[4];
 long lDataSize;
} WAVEHEADER;
 #pragma pack (pop)

I've tried like this:

QFile f;
...

WAVEHEADER wh;
...

f.write( (char*) &wh, sizeof( WAVEHEADER ) );

Any ideias?

-- 
Tiago Correia
chief technology officer

cnoti inovação & desenvolvimento – Aprendizagem enRiquecida pela Tecnologia
www.cnotinfor.pt
Telefone: +351 239 499 231

Subscreva gratuitamente a nossa Newsletter BICA – Boletim informativo de
Interactividade, Comunicação e Aprendizagem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090608/21670592/attachment.html 


More information about the Qt-interest-old mailing list