Question : Serialization in MFC

Hi experts,
            I Have a linked list. I need to serialize it how can i store the entire linked list and retrieve the same list from file.How I can use CArcieve Class for this purpose. Please help me to do this. Thanks in advance.
Thanks & Regards,
Vimal.

Answer : Serialization in MFC

Probably, you have your own list class. If you use the standard list (from STL), wrap it in a class. It should be derived from the CObject. Add the serialize methods and macros. Then, in the loop, you will write or read the data from the archive, like:
if( archive.IsStoring() )
{
     for (it = list.begin(); it != list.end(); ++it)
         archive << *iter;
}

MSDN. Serialization: Making a Serializable Class
http://msdn.microsoft.com/en-us/library/00hh13h0(VS.80).aspx

CObArray class in MFC supports the serialization and can work with the pointers. It, maybe, can be a good replacement.
http://msdn.microsoft.com/en-us/library/088sck34(VS.80).aspx
Random Solutions  
 
programming4us programming4us