Doofus
May 3rd, 1999, 07:36 AM
Trying to serialize a CPoint array of points for a drawing program so that drawing is saved when the file is saved, but not having too much success.
Would appreciate assistance in examining the following code to see what I am doing wrong.
Thanks in advance for your help.
void CSimpleAppView::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++) //to be retrieved
{
ar << PointArray[i].x;
ar << PointArray[i].y;
}
}
else
{ // loading code
ar >> m_Color; //Retrieve the pen color
ar >> m_ptCount; //Retrieve the previous
for (int i = 0; i < m_ptCount; i++) //drawing
{
ar >> PointArray[i].x;
ar >> PointArray[i].y;
}
}
}
Would appreciate assistance in examining the following code to see what I am doing wrong.
Thanks in advance for your help.
void CSimpleAppView::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++) //to be retrieved
{
ar << PointArray[i].x;
ar << PointArray[i].y;
}
}
else
{ // loading code
ar >> m_Color; //Retrieve the pen color
ar >> m_ptCount; //Retrieve the previous
for (int i = 0; i < m_ptCount; i++) //drawing
{
ar >> PointArray[i].x;
ar >> PointArray[i].y;
}
}
}