新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
CArchive串行化操作
串行化保存數(shù)據(jù)
創(chuàng)新互聯(lián)建站專業(yè)為企業(yè)提供衛(wèi)濱網(wǎng)站建設(shè)、衛(wèi)濱做網(wǎng)站、衛(wèi)濱網(wǎng)站設(shè)計(jì)、衛(wèi)濱網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、衛(wèi)濱企業(yè)網(wǎng)站模板建站服務(wù),十載衛(wèi)濱做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
//創(chuàng)建文件 CFile file(_T("1.txt"),CFile::modeCreate | CFile::modeWrite); //串行化,存儲(chǔ) CArchive ar(&file,CArchive::store); //存儲(chǔ)數(shù)據(jù) int i = 0x31; char ch = 'A'; float f = 1.3f; CString str(_T("chinayu@qq.com")); //寫入串行化 ar<串行化讀出數(shù)據(jù)
//打開文件 CFile file("1.txt",CFile::modeRead); //加載流 CArchive ar(&file,CArchive::load); //接收變量 int i; char ch; float f; CString str; CString strresult; //提取數(shù)據(jù)給變量 ar>>i>>ch>>f>>str; strresult.Format("%d,%c,%f,%s",i,ch,f,str);//轉(zhuǎn)化格式 AfxMessageBox(strresult);
當(dāng)前名稱:CArchive串行化操作
轉(zhuǎn)載來(lái)源:http://ef60e0e.cn/article/gdgsoi.html