2.9
[glibc/nacl-glibc.git] / manual / examples / memstrm.c
blob1674c36e0b175e062d203fd4c1b7a00c79765713
1 #include <stdio.h>
3 int
4 main (void)
6 char *bp;
7 size_t size;
8 FILE *stream;
10 stream = open_memstream (&bp, &size);
11 fprintf (stream, "hello");
12 fflush (stream);
13 printf ("buf = `%s', size = %d\n", bp, size);
14 fprintf (stream, ", world");
15 fclose (stream);
16 printf ("buf = `%s', size = %d\n", bp, size);
18 return 0;