急问一个文件保存的问题
我在VC++文档类里用Serialize保存数据到文件,
void CPaintDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
ar<<DotNum<<LineNum<<RectNum<<CircleNum<<PolyNum;
ar<<Dot_x[100]<<Dot_y[100]<<Line_bx[100]<<Line_by[100]<<Line_ex[100]<<Line_ey[100]
<<Rect_bx[100]<<Rect_by[100]<<Rect_ex[100]<<Rect_ey[100]
<<Circle_bx[100]<<Circle_by[100]<<Circle_ex[100]<<Circle_ey[100]
<<Poly_PeakNum[100]<<Poly_Peak_x[500]<<Poly_Peak_y[500];
// TODO: add storing code here
}
else
{
ar>>DotNum>>LineNum>>RectNum>>CircleNum>>PolyNum;
ar>>Dot_x[100]>>Dot_y[100]>>Line_bx[100]>>Line_by[100]>>Line_ex[100]>>Line_ey[100]
>>Rect_bx[100]>>Rect_by[100]>>Rect_ex[100]>>Rect_ey[100]
>>Circle_bx[100]>>Circle_by[100]>>Circle_ex[100]>>Circle_ey[100]
>>Poly_PeakNum[100]>>Poly_Peak_x[500]>>Poly_Peak_y[500];
// TODO: add loading code here
}
}
变量都是在文档类里面定义的.
运行程序,操作后保存,然后新建一个文件再打开刚保存的文件,没有任何问题。但是我关闭程序,再打开程序,然后打开刚保存的文件,数据怎么都丢失了???