How do I save/load STL data (map & vector)
-
Can someone show me how to send (save/Write) and receive (load/Read) data contained in a map and/or vector. class CData{ public: string one, two, three; CData() {}; ~CData() {} }; the map is declared as: map DATA; How do I read/write it's data to a file ("MyMapFile.dat") ??? vector vecDATA; how do I read/write it's data to a file("MyVecDATA.dat") ??? I'm new to the STL and would need explicit examples that are known to work properly PLEASE. C++ is my favorite programming language
-
Can someone show me how to send (save/Write) and receive (load/Read) data contained in a map and/or vector. class CData{ public: string one, two, three; CData() {}; ~CData() {} }; the map is declared as: map DATA; How do I read/write it's data to a file ("MyMapFile.dat") ??? vector vecDATA; how do I read/write it's data to a file("MyVecDATA.dat") ??? I'm new to the STL and would need explicit examples that are known to work properly PLEASE. C++ is my favorite programming language
You cannot automatically serialize STL objects to files. You must write your own file format. If you use only MFC then you can use CArray and CMap as containers and serialize with CArchive. Regards, Alexandru Savescu
-
Can someone show me how to send (save/Write) and receive (load/Read) data contained in a map and/or vector. class CData{ public: string one, two, three; CData() {}; ~CData() {} }; the map is declared as: map DATA; How do I read/write it's data to a file ("MyMapFile.dat") ??? vector vecDATA; how do I read/write it's data to a file("MyVecDATA.dat") ??? I'm new to the STL and would need explicit examples that are known to work properly PLEASE. C++ is my favorite programming language