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

When you say

what I want is to display in the following location C: \ Users \ abdelhalim \ Documents.

do you mean you want to write it to a file in that location?

yes i dont want it in the console but in this location :C: \ Users \ abdelhalim \ Documents.

Looks like this line
doc.SaveFile( "appsettings.xml" );
saves it to file anyway. Change that to
doc.SaveFile("C:/Users/abdelhalim/Documents/appsettings.xml");

commented: 10000000 +0

thankkk you verry much it worked

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.