Closed GoogleCodeExporter closed 9 years ago
I do not know yet if this is a bug or a feature; it's possible that the next
version
will have a corresponding save flag.
In the meantime, you can save your document to a file/stream that's open
without the
binary flag yourself, i.e.:
FILE* file = fopen(filename, "w");
if (file)
{
pugi::xml_writer_file writer(file);
doc.save(writer);
}
Original comment by arseny.k...@gmail.com
on 25 May 2010 at 7:54
What about just:
doc.save(std::ofstream(filename));
?
Original comment by jopi...@gmail.com
on 30 Nov 2011 at 9:05
Yes, that should work as well. There are several viable workarounds, if you can
use STL then probably the shortest one is using ofstream.
Original comment by arseny.k...@gmail.com
on 30 Nov 2011 at 4:03
I can't change the default behavior for several reasons:
- This is a compatibility-breaking change (however minor)
- More importantly, saving file as text is noticeably slower with MSVC CRT (of
course, the actual impact depends on I/O involved, disk flushing policies, etc.)
I've added an optional flag pugi::format_save_file_text; passing this flag to
save_file will open the file as text.
This was added to trunk as of r884; the change will go into the next pugixml
version as well.
Original comment by arseny.k...@gmail.com
on 23 Mar 2012 at 5:43
Original issue reported on code.google.com by
derek.ho...@gmail.com
on 25 May 2010 at 1:13