Saving Qt application data to a Custom Binary format.
-
Hi,
I am working on an application that does a lot of drawing and multimedia manipulation .I want to be able to save my data ( images /videos/..) in one file with our custom format ( .fmt for example) .I know QDataStream can write to a file but how can I have Images and Videos encapsulated within my binary file so that when a user saves the data he can later open and play it.Is there a possible way to do this?My search so far has pointed me to different ways to serialize data but I haven't seen anything that shows how to serialize multimedia.Am I approaching this the wrong way ?Any input will be appreciated.
Thanks.
-
It's easy to do. I have used this approach to write data to mifare cards.
You should create a header, similar to a ini file or http header. In this header you can list all the file names with size. For examplefilename0=a.txt
filesize0=123
filename1=b.jpg
filesize1=12345After that you should write the header, a empy row, and the all files.
-
For example if you have to write in one container file two files, file01.mpg, size 100 bytes, and file02.bmp size 200 bytes, you fill create a file with header + empy row, file01 and file 02. Total size is header size + empy row+ file01 size+ file02 size.
If you have to modify one file for example file01 you have to rewrite all.what are you working on?