Saving Data

If I have a CArray of a custom class what is teh best way to save that information to disk?  It only has to be read back in by the program that saves it.  Is there some way to just dump teh contents of the Array to a file and get it back without worrying about the intermediate format, or will I have to write a routine that goes thorugh the array one element member at a time at writes them to a file?


Using VC++ 6.0
LVL 1
syzygyAsked:
Who is Participating?
 
gvgConnect With a Mentor Commented:
CArray has a member called Serialize ( a CObject member ).  You can use it to save and load CArray with no knowledge of the file format.

It uses CArchive to achive this adn CArchive uses CFile to do the real save.

Hope this helps

Gunnar Valur
0
 
inprasCommented:
if UR class CArray is derived from CObject then use CArchive to store and read back thats the best way I believe
Regards
0
 
syzygyAuthor Commented:
Thanks Gunnar
0
All Courses

From novice to tech pro — start learning today.