Doofus
May 4th, 1999, 09:22 AM
Trying to serialize an array of CPoint elements without much success. Appreciate if someone could point out either what I'm doing wrong or what else I need to do. Thanks in advance.
Here's the code:
void CSimpleAppDoc::Serialize(CArchive& ar)
{
Serialize(ar);
if (ar.IsStoring())
{// storing code
ar << m_Color; //Store the pen color
ar << m_ptCount; //Store the drawing
for (int i = 0; i < m_ptCount; i++) {
ar << PointArray<i>.x;
ar << PointArray<i>.y;
}
}
else
{// loading code
ar >> m_Color; //Retrieve pen color
ar >> m_ptCount; //Retrieve drawing
for (int i = 0; i < m_ptCount; i++)
{
ar >> PointArray<i>.x;
ar >> PointArray<i>.y;
}
}
}
Here's the code:
void CSimpleAppDoc::Serialize(CArchive& ar)
{
Serialize(ar);
if (ar.IsStoring())
{// storing code
ar << m_Color; //Store the pen color
ar << m_ptCount; //Store the drawing
for (int i = 0; i < m_ptCount; i++) {
ar << PointArray<i>.x;
ar << PointArray<i>.y;
}
}
else
{// loading code
ar >> m_Color; //Retrieve pen color
ar >> m_ptCount; //Retrieve drawing
for (int i = 0; i < m_ptCount; i++)
{
ar >> PointArray<i>.x;
ar >> PointArray<i>.y;
}
}
}