writing to a char buffer as a FILE*

This is a discussion on writing to a char buffer as a FILE* within the C++ Programming forums, part of the General Programming Boards category; I am trying to use an old library I found that I am unable to modify.
The function I am ...

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

"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens

I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.

I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.

Manasij Mukherjee | gcc-4.9.2 @Arch Linux Slow and Steady wins the race... if and only if :1.None of the other participants are fast and steady.
2.The fast and unsteady suddenly falls asleep while running !

At that point, though, it would be MUCH easier (and more portable) to just follow laserlight's suggestion and have the function write its data to a file and then read that file back in.

Portable, agreed.
But..easier not.
I am talking about writing to a file too...in every sense.
But the why tell the filesystem to manage it and incur the disk overhead when the kernel can create the object essentially for free (afaik)?
After that normal File IO can be used, but the program doesn't need to know that the file does not really physically exist on the disk.

(I'm talking from a Linux(or any other *nix) perspective though and don't know how these are done on Windows)

Manasij Mukherjee | gcc-4.9.2 @Arch Linux Slow and Steady wins the race... if and only if :1.None of the other participants are fast and steady.
2.The fast and unsteady suddenly falls asleep while running !

Manasij Mukherjee | gcc-4.9.2 @Arch Linux Slow and Steady wins the race... if and only if :1.None of the other participants are fast and steady.
2.The fast and unsteady suddenly falls asleep while running !

Manasij Mukherjee | gcc-4.9.2 @Arch Linux Slow and Steady wins the race... if and only if :1.None of the other participants are fast and steady.
2.The fast and unsteady suddenly falls asleep while running !