diff options
Diffstat (limited to 'libc/manual/examples/memstrm.c')
-rw-r--r-- | libc/manual/examples/memstrm.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libc/manual/examples/memstrm.c b/libc/manual/examples/memstrm.c new file mode 100644 index 000000000..1674c36e0 --- /dev/null +++ b/libc/manual/examples/memstrm.c @@ -0,0 +1,19 @@ +#include <stdio.h> + +int +main (void) +{ + char *bp; + size_t size; + FILE *stream; + + stream = open_memstream (&bp, &size); + fprintf (stream, "hello"); + fflush (stream); + printf ("buf = `%s', size = %d\n", bp, size); + fprintf (stream, ", world"); + fclose (stream); + printf ("buf = `%s', size = %d\n", bp, size); + + return 0; +} |