Hi,
I was trying to use the LoadFile method on a FILE *
stream created with popen. To my disappointment, I
found out that these descriptors (generally, pipe
descriptors) cannot be seeked.
So I patched the LoadFile method to catter for this
situation: LoadFile uses a bunch of fseek/ftell to
obtain the size of the file to do its buffer
allocation, this fails miserably by return -1 if the
given FILE * was created with popen (in my case; I
reckon pipes will also behave like this), so I added a
test for this and some code to do the read/reallocation
until the pipe is exhausted. I know it would be
inefficient if the amount of data in the pipe was big
enough (I used a realloc sort of mechanism, with a
fixed block read size), but in my case (parsing RSS
feeds...), the files are small enough so that I can
happily live with the current performances.
I guess this could be integrated/modified as see fit in
a next release of TinyXML.
BTW, great lightweight parser!
Cheers,
JB
Patch of tinyxml.cpp against CVS rev 1.95