📄 subject_20495.htm
字号:
<p>
序号:20495 发表者:祥子_林 发表日期:2002-11-07 09:22:02
<br>主题:help!!!
<br>内容:void CMyDoc::Serialize(CArchive& ar)<BR>{<BR> CString str;<BR> POSITION pos;<BR> int count=0;<BR> if (ar.IsStoring())<BR> {<BR> <BR> pos=m_pStrList->GetHeadPosition();<BR> while(pos!=NULL)<BR> {<BR> str=m_pStrList->GetNext(pos);<BR> ar<<str;<BR> }<BR> ar<<m_pStrList->GetCount();<BR> }<BR> else<BR> {<BR> ar>>count;//////// A<BR> m_pStrList->RemoveAll();<BR> for(int i=1;i<=count;i++)<BR> {<BR> <BR> ar>>str;<BR> m_pStrList->AddHead(str);<BR> }<BR> }<BR>}<BR>我在写入数据时没有什么错误,但在读取时刚才写入的文件时却提醒格式错误,调试时发现A行里的count是个狂大的数,而我只写入一个,即count本应为1,不知为什么,请高手指教!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:徐景周 回复日期:2002-11-07 09:42:00
<br>内容:count应该写在前面,如:<BR>if (ar.IsStoring())<BR> {<BR> ar<<m_pStrList->GetCount();<BR> <BR> pos=m_pStrList->GetHeadPosition();<BR> while(pos!=NULL)<BR> {<BR> str=m_pStrList->GetNext(pos);<BR> ar<<str;<BR> }<BR> }<BR> else<BR> {<BR> ar>>count;//////// A<BR> m_pStrList->RemoveAll();<BR> for(int i=1;i<=count;i++)<BR> {<BR> <BR> ar>>str;<BR> m_pStrList->AddHead(str);<BR> }<BR> }<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -