views:

138

answers:

1
+4  Q: 

String Stream in C

print2fp(const void *buffer, size_t size, FILE *stream) {

 if(fwrite(buffer, 1, size, stream) != size)
  return -1;

 return 0;
}

How to write the data into string stream instead of File stream?

+1  A: 

String Streams
http://www.gnu.org/s/libc/manual/html_node/String-Streams.html

Robert Harvey
I tried this but I got this error[Linker error] undefined reference to `fmemopen'
Said
fmemopen and open_memstream not in my stdio.h
Said
@Said: then you might need to specify your platform, which is apparently not Linux.
Jonathan Leffler
The link is 404.
Helmut
If you're on BSDish systems, you may have access to funopen and can implement a memory based stream, similar to fmemopen (which is implemented on top of fopencookie). Solaris and native Windows systems are out of luck.
Wez Furlong