Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Saving Qt application data to a Custom Binary format.
QtWS25 Last Chance

Saving Qt application data to a Custom Binary format.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • musimbateM Offline
    musimbateM Offline
    musimbate
    wrote on last edited by
    #1

    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.

    Why join the navy if you can be a pirate?-Steve Jobs

    1 Reply Last reply
    0
    • mrdebugM Offline
      mrdebugM Offline
      mrdebug
      wrote on last edited by
      #2

      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 example

      filename0=a.txt
      filesize0=123
      filename1=b.jpg
      filesize1=12345

      After that you should write the header, a empy row, and the all files.

      Need programmers to hire?
      www.labcsp.com
      www.denisgottardello.it
      GMT+1
      Skype: mrdebug

      1 Reply Last reply
      0
      • musimbateM Offline
        musimbateM Offline
        musimbate
        wrote on last edited by
        #3

        Thanks for the reply mrdebug,
        I don't quite get how your method here works though,how does the header encapsulate my videos and images is not clear yet.Can you explain more or point to a detailed resource to learn about that?

        Thanks.

        Why join the navy if you can be a pirate?-Steve Jobs

        1 Reply Last reply
        0
        • mrdebugM Offline
          mrdebugM Offline
          mrdebug
          wrote on last edited by
          #4

          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?

          Need programmers to hire?
          www.labcsp.com
          www.denisgottardello.it
          GMT+1
          Skype: mrdebug

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved