home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / manual / examples / memstrm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-11  |  331 b   |  20 lines

  1. #include <stdio.h>
  2.  
  3. int
  4. main (void)
  5. {
  6.   char *bp;
  7.   size_t size;
  8.   FILE *stream;
  9.  
  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);
  17.  
  18.   return 0;
  19. }
  20.