TinyXML:如何解析文件指针
我正在尝试将 popen(文件指针)的输出连接到 TinyXML 的输入。
根据主页,最好的方法是使用解析方法:
C style input:
* based on FILE*
* the Parse() and LoadFile() methods
我相信我需要使用 TIXML_USE_STL 来实现这一点。 我如何找到示例并导入它?
删除后的回复为我指明了文档的正确方向
http://www.grinninglizard.com /tinyxmldocs/index.html
谢谢。
现在,我只需要弄清楚如何链接和导入它。
I'm trying to connect the output of popen, a file pointer, to the input of TinyXML.
According to the main page, the best way to do it is using the parse method:
C style input:
* based on FILE*
* the Parse() and LoadFile() methods
I believe I need to use the TIXML_USE_STL to get to this. How do I go about finding examples and import it?
A reply since deleted pointed me in the right direction on the docs
http://www.grinninglizard.com/tinyxmldocs/index.html
Thanks.
Now, i just need to figure out how to link and import it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对 TinyXML 不太熟悉,但是
LoadFile()
在其采用FILE *
的重载版本中不起作用吗?http://www.grinninglizard.com/tinyxmldocs/classTiXmlDocument.html#a12
编辑: 啊,问题是 TinyXML 不支持从流中读取(请参阅上面的链接)。 那么您唯一的选择就是手动将流读入缓冲区并将其传递给 TinyXML 的
Parse()
。I'm not hugely familiar with TinyXML, but does
LoadFile()
not work in its overloaded version which takes aFILE *
?http://www.grinninglizard.com/tinyxmldocs/classTiXmlDocument.html#a12
EDIT: Ah, the problem is that TinyXML doesn't support reading from a stream (see the link above). Your only choice then is to read the stream manually into a buffer and pass it to TinyXML's
Parse()
.您可以将文件数据读入某个缓冲区(例如 SomeCharBuffer),向其附加 null 终止符并执行
You can read the file data into some buffer (say SomeCharBuffer), append null terminator to it and do