Hi,

I'm attempting to use serialization but not sure if I'm on the right track.
What's wrong so far? Any help appreciated.

arItems is a CArray of my CQnItem objects and CQnItem knows how to serialize
(suppose it will work, haven't tried it yet).

void CQnDBF::Serialize(CArchive& ar)
{
CObject::Serialize(ar);
if(ar.IsStoring())
{
int i, n = arItems.GetSize();
ar << n; // store number of items in array
for(i = 0; i < n; i++)
{
CQnItem *qni;
qni = new CQnItem(arItems.GetAt(i));
ar << qni;
if(qni) delete qni; // ??
}
}
else
{
int i, n;
ar >> n; // read number of items in array
for(i = 0; i < n; i++)
{
// not sure what to do here
CQnItem qni;
qni = new CQnItem();
ar >> qni;
arItems.Add(qni); // no go
if(qni) delete qni; // ??
}
}
}

Thanks

Paul