Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:
C++
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
Posted

hi

i solve it , so i use this :
C++
doc.SaveFile("C:/Users/abdelhalim/Documents/appsettings.xml");
insted of
C++
doc.SaveFile("appsettings.xml");


thank you for your help :)
 
Share this answer
 
Comments
Argonia 21-Aug-13 4:13am    
For that kind of paths its better to use SHGetSpecialFolderPath function (http://msdn.microsoft.com/en-us/library/windows/desktop/bb762204%28v=vs.85%29.aspx)
You want to learn about the CreateFile[^] API.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900