2

I just asked myself if there are any differences between saving a file via doc.Print() and doc.SaveFile() in tinyxml2.

Here is a quick example:
Let's say we have a filepointer and a XML document from where we get our data.

FILE filepointer("MyFile.xml", "rb") //empty file
XMLDocument doc;
doc.LoadFile("SourceFile.xml")       //file we extract data from

Now we have two options to save the file.

XMLPrinter printer(filepointer)
doc.Print(&printer)

vs

doc.SaveFile(filepointer)

Are there any differences in these approaches?

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
  • Maybe go look in the [documentation](http://leethomason.github.io/tinyxml2/classtinyxml2_1_1_x_m_l_document.html)? – Carl Jun 27 '18 at 12:10
  • @Carl the only thing that is stated is the use of the printer to save the data to the memory. But beside that there is not more information on that. I am asking for the specific case when you want to save a file. – Blubsiwubsi Jun 27 '18 at 12:14

1 Answers1

3

SaveFile just does a Print internally, see https://github.com/leethomason/tinyxml2/blob/c0ff869500f3d2b828eeefc725a5bc1ff9b844f0/tinyxml2.cpp#L2247

Alan Birtles
  • 32,622
  • 4
  • 31
  • 60