Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. File Serialization versus old style data saving on files

File Serialization versus old style data saving on files

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsonquestion
6 Posts 5 Posters 0 Views 1 Watching
  • 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.
  • K Offline
    K Offline
    Kwanalouie
    wrote on last edited by
    #1

    Using Visual C++ 6.0 MFC in SDI. I'm basically a C programmer doing C++ with MFC. I'm trying to understand what "Serialization" does for me in terms of file I/O. I would like to use the MFC SDI file menu items, but simply code my file input/output in basically the oldstyle - just opening and closing files and storing and retrieving the variable info that is necessary for my program. Is it simple to mix the oldstyle file I/O with the SDI file menu handling items or do I need to learn about serialization? Thanks ahead of time.

    CPalliniC H D 3 Replies Last reply
    0
    • K Kwanalouie

      Using Visual C++ 6.0 MFC in SDI. I'm basically a C programmer doing C++ with MFC. I'm trying to understand what "Serialization" does for me in terms of file I/O. I would like to use the MFC SDI file menu items, but simply code my file input/output in basically the oldstyle - just opening and closing files and storing and retrieving the variable info that is necessary for my program. Is it simple to mix the oldstyle file I/O with the SDI file menu handling items or do I need to learn about serialization? Thanks ahead of time.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      If you need to store and retrieve objects, serialization is better. IMHO exploiting MFC's serialization is also amusing. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

      In testa che avete, signor di Ceprano?

      T 1 Reply Last reply
      0
      • CPalliniC CPallini

        If you need to store and retrieve objects, serialization is better. IMHO exploiting MFC's serialization is also amusing. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        XML serialization is even better. also, one has to be very careful with serialzed filed if moved from one system to another, because some types can be written/read differently depending on the system...

        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        CPalliniC 1 Reply Last reply
        0
        • K Kwanalouie

          Using Visual C++ 6.0 MFC in SDI. I'm basically a C programmer doing C++ with MFC. I'm trying to understand what "Serialization" does for me in terms of file I/O. I would like to use the MFC SDI file menu items, but simply code my file input/output in basically the oldstyle - just opening and closing files and storing and retrieving the variable info that is necessary for my program. Is it simple to mix the oldstyle file I/O with the SDI file menu handling items or do I need to learn about serialization? Thanks ahead of time.

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          For save your data's you can use of files that you said or Pallini's suggestion or XML's or even use of registry.

          1 Reply Last reply
          0
          • K Kwanalouie

            Using Visual C++ 6.0 MFC in SDI. I'm basically a C programmer doing C++ with MFC. I'm trying to understand what "Serialization" does for me in terms of file I/O. I would like to use the MFC SDI file menu items, but simply code my file input/output in basically the oldstyle - just opening and closing files and storing and retrieving the variable info that is necessary for my program. Is it simple to mix the oldstyle file I/O with the SDI file menu handling items or do I need to learn about serialization? Thanks ahead of time.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Kwanalouie wrote:

            I would like to...simply code my file input/output in basically the oldstyle - just opening and closing files and storing and retrieving the variable info that is necessary for my program.

            You might want to give object serialization a try just to see how it works. It might surprise you.

            Kwanalouie wrote:

            Is it simple to mix the oldstyle file I/O with the SDI...

            Certainly. Instead of using your document's Serialize() method, you would instead write to and read from your file(s) in methods like OnSaveDocument(), OnOpenDocument().

            "Love people and use things, not love things and use people." - Unknown

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            1 Reply Last reply
            0
            • T toxcct

              XML serialization is even better. also, one has to be very careful with serialzed filed if moved from one system to another, because some types can be written/read differently depending on the system...

              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              toxcct wrote:

              XML serialization is even better.

              Really depends on needs (XML is quite verbose).

              toxcct wrote:

              also, one has to be very careful with serialzed filed if moved from one system to another, because some types can be written/read differently depending on the system...

              MFC by itself are not such portable. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

              In testa che avete, signor di Ceprano?

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups