CMarkup的保存与读取
来源:互联网 发布:在windows上启动mysql 编辑:程序博客网 时间:2024/06/05 06:53
CArray<STest *,STest *> arTest; // 动态数组的创建 存的是指向结构体的指针 这样效率快
struct Stest
{
int nData;
float fData;
CString strData;
}
ArTest arTest;STest *pTest1 = new STest(1, 1.0f, _T("111"));STest *pTest2 = new STest(2, 2.0f, _T("222"));STest *pTest3 = new STest(3, 3.0f, _T("333"));arTest.Add(pTest1); arTest.Add(pTest2);arTest.Add(pTest3);STest *pTempTest = NULL;CString strTemp;CMarkup markupSave;markupSave.AddElem(_T("Head"));int i, nSize = (int)arTest.GetSize();for (i = 0; i < nSize; i++){pTempTest = arTest[i];markupSave.AddChildElem(_T("STest"));markupSave.IntoElem();strTemp.Format(_T("%d"), pTempTest->nData);markupSave.SetAttrib(_T("nData"), strTemp);strTemp.Format(_T("%f"), pTempTest->fData);markupSave.SetAttrib(_T("fData"), strTemp);markupSave.SetAttrib(_T("strData"), pTempTest->strData);markupSave.OutOfElem();}markupSave.Save(_T("D:\\Test.xml"));CMarkup markupRead;if (markupRead.Load(_T("D:\\Test.xml"))){ArTest arTestRead;if (markupRead.FindElem(_T("Head"))){while(markupRead.FindChildElem(_T("STest"))){//方法1markupRead.IntoElem();pTempTest = new STest;pTempTest->nData = _ttoi(markupRead.GetAttrib(_T("nData")));pTempTest->fData = (float)_tstof(markupRead.GetAttrib(_T("fData")));pTempTest->strData = markupRead.GetAttrib(_T("strData"));arTestRead.Add(pTempTest);markupRead.OutOfElem();//方法2// pTempTest = new STest;// pTempTest->nData = _ttoi(markupRead.GetChildAttrib(_T("nData")));// pTempTest->nData = (float)_tstof(markupRead.GetChildAttrib(_T("fData")));// pTempTest->strData = markupRead.GetChildAttrib(_T("strData"));// arTestRead.Add(pTempTest);}}}
0 0
- CMarkup的保存与读取
- Cookie的保存与读取
- CTreeCtrl项目的保存与读取
- Combo Box信息的保存与读取
- 对iframe数据的保存与读取
- android中文件的保存与读取
- Android----文件的保存与读取
- webview中cookie的读取与保存
- Android---02---文件的保存与读取
- 实例教程三:文件的保存与读取
- android文件的保存与读取
- 多个对象的保存与读取
- android---文件的保存与读取
- json文件的读取与保存
- BMP图像的读取与保存
- Android文件的读取与保存
- android文件的保存与读取
- C# 文件的保存与读取
- 匿名管道详解与使用
- mac OSX 使用Diango创建数据库报错Referenced from: /Library/Python/2.7/site-packages/_mysql.so
- 经典的重定位代码
- CentOS 6.5下本地yum源与网络yum源的配置使用
- C++内存管理
- CMarkup的保存与读取
- WIN32串口编程详解(一)
- Codeforces544C:Writing Code(完全背包)
- druid项目实例
- hdu 4966 GGS-DDU(无固定根的最小树形图)
- 存储 key/value的hashtable
- Exe4j破解_Exe4j注册码
- WIN32串口编程详解(二)
- XDOJ 数独