tags:

views:

542

answers:

2

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.

+2  A: 

I'm not hugely familiar with TinyXML, but does LoadFile() not work in its overloaded version which takes a FILE *?

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().

Mark Pim
A: 

You can read the file data into some buffer (say SomeCharBuffer), append null terminator to it and do

TiXmlDocument doc;  
doc.Parse(SomeCharBuffer);
error.exit