void CMfctempDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CFile file("1.txt",CFile::modeCreate|CFile::modeReadWrite );
CArchive ar(&file,CArchive::store);
int i=4;
char ch='a';
float f=1.3f;
CString str("hello kugoo");
ar<<i<<ch<<f<<str;
}
void CMfctempDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CFile file("1.txt",CFile::modeReadWrite );
CArchive ar(&file,CArchive::load);
int i;
char ch;
float f;
CString str,yk;
ar>>i>>ch>>f>>str;
yk.Format("%i,%c,%f,%s",i,ch,f,str);
MessageBox(yk);
}
CArchive 序列化,持久性
最新推荐文章于 2021-05-23 11:45:10 发布