How can one write newline characters between TiXmLText elements in a Tiny XML DOM Object using Visual Studio 2008 C++?

I am using TinyXML library in my project to produce a Xml file. (C++ Visual Studio 2008).
I want to write each name in one line but all of them between a couple tags. I would like the output format below:
   <?xml version="1.0"?>
    <opencv_storage>
    <images>
    ./images/cam01.jpg
    ./images/cam02.jpg
    ./images/cam03.jpg
    ./images/cam04.jpg
    ./images/cam05.jpg
    ./images/cam06.jpg
    ./images/cam07.jpg
    ./images/cam08.jpg
    ./images/cam09.jpg
    ./images/cam10.jpg
    ./images/cam11.jpg
    ./images/cam12.jpg
    ./images/cam13.jpg
    ./images/cam14.jpg
    </images>
    </opencv_storage>
but I dont know How can I write the new line between them . by my code here:
  TiXmlDocument document;
  TiXmlElement* msg;
  TiXmlDeclaration* dec1 = new TiXmlDeclaration("1.0","","");
  document.LinkEndChild(dec1);

  TiXmlElement * root = new TiXmlElement( "opencv_storage" );  
  document.LinkEndChild( root );
  msg = new TiXmlElement("images");

  openFileDialog1->Title = "Select an Image file";

 if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)

  {
     for each (String^ file in openFileDialog1->SafeFileNames)
         {
         std::stringstream v;
         v << openFileDialog1->FileName;
         TiXmlText* txt = new TiXmlText(v.str());
         msg->LinkEndChild(txt);
         }
              root->LinkEndChild(msg);


          document.SaveFile("VID5.xml");

     }
by this Code I produce such file :
 <?xml version="1.0" ?>
    <opencv_storage>
    <images>C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpgC:\Users\Public  \Pictures\Sample Pictures\Chrysanthemum.jpg
    </images>
    </opencv_storage>
How Can I write a newline character between these names ?
Any help is greatly appreciated.
camster123Senior C++ Software EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BullockQA Engineer IIICommented:
The newline character in C++ is \n
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
camster123Senior C++ Software EngineerAuthor Commented:
Thank you for the solution. I believe there is a difference in C++ between endl and '\n'
0
Mark BullockQA Engineer IIICommented:
I think endl will flush the buffer or stream.
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.