File Serialization versus old style data saving on files
-
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.
-
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.
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 -
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 ClarkeXML 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]
-
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.
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.
-
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.
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 likeOnSaveDocument()
,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
-
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]
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