writing to a char buffer as a FILE*
I am trying to use an old library I found that I am unable to modify.
The function I am trying to use takes in a FILE* as a parameter, and writes to this stream using the fprintf function.
Useally this function has only been used to print stuff to stdout, and this works well. What I need to do is to get this to write to a char buffer.
The function looks something like this:
what I want to do is to init a char buffer
void print( FILE* fileStream, int value )
fprintf( fileStream, "value: %d", value );
char characterBuffer[ 1024 ];
and with the use of some tool get the print function to write to this characterBuffer. I' ve tried to use stringstream and a few other things, but I am unable to get this to work properly (so that is I toss this characterBuffer into a printf, the output is readable).
Anyone know of a way to do this?