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

Arnold Krille arnold at arnoldarts.de
Mon Jun 8 16:06:54 CEST 2009


On Monday 08 June 2009 14:44:25 Tiago Correia wrote:
> 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.
> I've tried like this:
> QFile f;
> WAVEHEADER wh;
> f.write( (char*) &wh, sizeof( WAVEHEADER ) );

Are you writing soundfiles to disk? Why not use libsndfile? That has support for 
_a lot_ of formats.

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090608/785824ae/attachment.bin 


More information about the Qt-interest-old mailing list