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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

if UR class CArray is derived from CObject then use CArchive to store and read back thats the best way I believe
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
syzygyAuthor Commented:
Thanks Gunnar
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.