问题描述
有什么办法来创建一个内存缓冲区作为文件*。在TiXml它可以打印XML到FILE *,但我不能似乎使打印到内存缓冲区。
Is there any way to create a memory buffer as a FILE*. In TiXml it can print the xml to a FILE* but i cant seem to make it print to a memory buffer.
推荐答案
没有,你不能创建一个内存块,看起来像一个FILE *。当你去想它,因为没有办法知道有多少数据将被写入这是不可能的。
No, you cannot create a block of memory that looks like a FILE*. When you think about it this would be impossible since there's no way to know how much data would be written.
使用运营商的LT TinyXML的不过;你可以写一个C ++流,其可以是一个标准::字符串或您所选择的流。另外,您可以使用TiXMLPrinter类。
However with TinyXML using operator << you can write to a C++ stream which can either be an std::string or a stream of your choosing. Alternatively you can use the TiXMLPrinter class.
查看XML微型网站上的印刷部;
See the Printing section on the Tiny XML site;
这篇关于内存缓冲区为FILE *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!