创建一个xml文件并将其显示在控制台以外的固定位置 [英] create a xml file and display it in a fixed location other than the console
本文介绍了创建一个xml文件并将其显示在控制台以外的固定位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我想知道如何创建一个xml文件并将其显示在控制台以外的固定位置,我已成功创建并在控制台中显示它,我是什么想要显示在以下位置C:\ Users \ abdelhalim \ Documents。
我使用TinyXML创建xml文件,我的代码是如下:
Hi everyone!
I would like to know how to create a xml file and display it in a fixed location other than the console, I have successfuly create and display it in the console, what I want is to display in the following location C: \ Users \ abdelhalim \ Documents.
I use TinyXML to create the xml file, and my code is as follows:
void crerxmlfichier1::write_simple_doc2(int n,int m )
{
// same as write_simple_doc1 but add each node
// as early as possible into the tree.
TiXmlDocument doc;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild( decl );
TiXmlElement * root = new TiXmlElement( "TestPlan" );
doc.LinkEndChild( root );
int k=0;
for (int i = 0; i <n; i++){
TiXmlElement * em = new TiXmlElement( "Testeur" );
root->LinkEndChild( em );
++k;
char f[50];
sprintf(f, "%s%d", "N", k);
em->SetAttribute("Node", f);
k=i+1;
char j[50];
sprintf(j, "%s%d", "T", k);
em->SetAttribute("id", j);
}
dump_to_stdout( &doc );
doc.SaveFile( "appsettings.xml" );
}
如果能帮助我,我将非常感激。
美好的一天
I'll be very grateful if you can help me.
good day
推荐答案
您想了解 CreateFile [ ^ ] API。
You want to learn about the CreateFile[^] API.
hi
i解决它,所以我用它:
hi
i solve it , so i use this :
doc.SaveFile("C:/Users/abdelhalim/Documents/appsettings.xml");
insted of
insted of
doc.SaveFile("appsettings.xml");
感谢您的帮助:)
thank you for your help :)
这篇关于创建一个xml文件并将其显示在控制台以外的固定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文