1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <stdio.h> static char buffer[] = "foobar"; int main (void) { int ch; FILE *stream; stream = fmemopen (buffer, strlen (buffer), "r"); while ((ch = fgetc (stream)) != EOF) printf ("Got %c\n", ch); fclose (stream); return 0; }