archive

作者: fffwc | 来源:发表于2020-10-14 11:24 被阅读0次

void CMainFrame::OnArchiveWrite()

{

// TODO:  在此添加命令处理程序代码

CFile file;

BOOL isOk = file.Open(TEXT("../a.txt"), CFile::modeCreate | CFile::modeWrite);

    if (FALSE == isOk)

    {

return;

    }

CArchive  ar(&file, CArchive::store);

int a = 10;

CString str = TEXT("ABC");

TCHAR ch = 'A';

ar << a << str << ch;

ar.Close();

file.Close();

}

void CMainFrame::OnArchiveRead()

{

CFile file;

BOOL isOk = file.Open(TEXT("../a.txt"),  CFile::modeRead);

if (FALSE == isOk)

{

return;

}

CArchive  ar(&file, CArchive::load);

int a;

CString str;

TCHAR ch;

ar >> a >> str >> ch;

CString s;

s.Format(TEXT("%d  %s    %c"), a, str, ch);

MessageBox(s);

ar.Close();

file.Close();

}

相关文章

网友评论

      本文标题:archive

      本文链接:https://www.haomeiwen.com/subject/cdgipktx.html