J
Jim Langston
I had asked this in comp.lang.c++ with out any answers that would actually
work, so I'm hoping someone here may know a way.
I am calling C library functions that want to output to stdout. I need to
capture this to memory for use internally inside the program without
modifying the library calls that actually do the output.
This is for the GraphViz libraries and it is the output of dot that I'm
actually trying to capture. I have compiled all the libraries and the dot
exectuable which outputs to stdcout. There is also an option to output to a
file and if someone knows a way of redirecting a FILE* to memory that would
work too. There is an option to output to memory but it is a static buffer
that is WAY too small and is broken anyway. When trying this way I get a
memory error and tracing through the code somewhere deep inside the library
it's attempting to write to a FILE*
If no one knows of a way I will have to write a libary function to do this
and have to delve into the GraphViz libraries and try not to come across the
same bug that the pervious person who was attempting to write to memory
does.
One thing I will do in my attempt is not allocate the memory inside the
library as is currently attempted, but pass in a function pointer to
allocate the memory (that will probably just wrap malloc and/or remalloc).
Any help is appreciated. The GraphViz library is pure C.
work, so I'm hoping someone here may know a way.
I am calling C library functions that want to output to stdout. I need to
capture this to memory for use internally inside the program without
modifying the library calls that actually do the output.
This is for the GraphViz libraries and it is the output of dot that I'm
actually trying to capture. I have compiled all the libraries and the dot
exectuable which outputs to stdcout. There is also an option to output to a
file and if someone knows a way of redirecting a FILE* to memory that would
work too. There is an option to output to memory but it is a static buffer
that is WAY too small and is broken anyway. When trying this way I get a
memory error and tracing through the code somewhere deep inside the library
it's attempting to write to a FILE*
If no one knows of a way I will have to write a libary function to do this
and have to delve into the GraphViz libraries and try not to come across the
same bug that the pervious person who was attempting to write to memory
does.
One thing I will do in my attempt is not allocate the memory inside the
library as is currently attempted, but pass in a function pointer to
allocate the memory (that will probably just wrap malloc and/or remalloc).
Any help is appreciated. The GraphViz library is pure C.