Percent symbol replaced with the word "Success" in cdata
Brought to you by:
kaalus
My code looks like this:
std::string str = "% mem=2000MB"; // This stays in scope until after the document is written
xml_node<>* text = doc.allocate_node(node_cdata, NULL, str.c_str(), 0, str.length());
...
This text is being written in the cdata tag:
<![CDATA[Successem=2000MB]]>
Here's a complete sample program:
The output is:
<test>
<![CDATA[Successem=2000MB]]>
</test>
Perhaps you should NOT use "fprintf" if you simply want to print the content of a string - a common programming error (just because we use this (f)printf so often) and also a source of exploits :)
Use fputs instead or "fprintf(f,"%s",s.c_str());".
Should have caught that myself. Thanks!