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. Serializing Data to file

Serializing Data to file

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpvisual-studiocom
3 Posts 2 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
    karmendra_js
    wrote on last edited by
    #1

    I use the tecnique show in this article this is working fine in vc++ of visual studio 6, but in vc++ of visual studio the file is not stored properly. How should i serialize and store my data i want this to be done for a class derived from CDialog class. Thanks for your time.

    K 1 Reply Last reply
    0
    • K karmendra_js

      I use the tecnique show in this article this is working fine in vc++ of visual studio 6, but in vc++ of visual studio the file is not stored properly. How should i serialize and store my data i want this to be done for a class derived from CDialog class. Thanks for your time.

      K Offline
      K Offline
      karmendra_js
      wrote on last edited by
      #2

      oh god i am really sorry, I found the error. When i inserted the serialization using the class wizard it inserted the code as follows

      if (ar.IsStoring())
      	{	// storing code
                      ar >> m_strName;
                      ar >> m_nIndex;
      	}
      	else
      	{	// loading code
                      ar << m_strName;
                      ar << m_nIndex;
      	}
      

      note IsStoring there. and in the article the same function is as follows

       if (ar.IsLoading()) // If you are loading data from the disk
          {
              ar >> m_strName;
              ar >> m_nIndex;
          }
          else // If you are storing data to the disk
          {
              ar << m_strName;
              ar << m_nIndex;
          }
      

      note IsLoading here. My mistake was i used the wrong indirection. Make a note of it and never do such a stupid mistake. I wasted 5 hours on this. :((

      D 1 Reply Last reply
      0
      • K karmendra_js

        oh god i am really sorry, I found the error. When i inserted the serialization using the class wizard it inserted the code as follows

        if (ar.IsStoring())
        	{	// storing code
                        ar >> m_strName;
                        ar >> m_nIndex;
        	}
        	else
        	{	// loading code
                        ar << m_strName;
                        ar << m_nIndex;
        	}
        

        note IsStoring there. and in the article the same function is as follows

         if (ar.IsLoading()) // If you are loading data from the disk
            {
                ar >> m_strName;
                ar >> m_nIndex;
            }
            else // If you are storing data to the disk
            {
                ar << m_strName;
                ar << m_nIndex;
            }
        

        note IsLoading here. My mistake was i used the wrong indirection. Make a note of it and never do such a stupid mistake. I wasted 5 hours on this. :((

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

        karmendra_js wrote: I wasted 5 hours on this. It was only a waste if you failed to learn anything from the experience.


        "One must learn from the bite of the fire to leave it alone." - Native American Proverb

        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