TinyXML:将文档保存到char *或字符串 [英] TinyXML: Save document to char * or string
问题描述
我正在尝试使用TinyXML从内存读取和保存,而不是仅将文件读取和保存到磁盘.
I'm attempting to use TinyXML to read and save from memory, instead of only reading and saving files to disk.
似乎文档的parse函数可以加载char *.但是之后,我需要将文档保存到char *中.有人知道吗?
It seems that the documnent's parse function can load a char *. But then I need to save the document to a char * when I'm done with it. Does anyone know about this?
打印和流功能不是我想要的.它们以可见格式输出,我需要实际的xml内容.
打印很棒.
推荐答案
我对TinyXML并不熟悉,但是从文档看来,通过使用运算符<<到C ++流(因此您可以使用 C ++字符串流)或 TiXMLPrinter类,您无需使用文件即可获取STL字符串.请参见 TinyXML文档(查找打印"部分)
I'm not familiar with TinyXML, but from the documentation it seems that by using operator << to a C++ stream (so you can use C++ string streams) or a TiXMLPrinter class you can get an STL string without using a file. See TinyXML documentation (look for the "Printing" section)
这篇关于TinyXML:将文档保存到char *或字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!