MichaĆ Nowotka wrote:
Hi Boosters,
I have a function with following interface:
int gvRender (GVC_t *gvc, graph_t *g, char *format, FILE *out)
but I don't want to store the output in temporary file but to compute everything in memory... (but to store the output to same malloced string and pass it to a display function). Boost is so powerful - so can I solve this problem somehow using boost (C++ doesn't doesn't provide tools to simulate file descriptors )? I know very little about boost iostream would it be helpful?
Not sure if it is what you want, but you could look at container_device_example.cpp in libs\iostreams\example For example we could do something like this to write a zipped and encrypted stream of data into a std::string ... io::filtering_ostream out; out.push( io::gzip_compressor() ); out.push( CryptFilter(key) ); std::string memString; out.push ( container_sinkstd::string (memString)); WriteStuff(out); // this writes stuff to the stream out.reset(); // flush it At this point the stuff is in the memString.