5 FILE *f
= fopen("fred.txt", "w");
6 fwrite("hello\nhello\n", 1, 12, f
);
10 f
= fopen("fred.txt", "r");
11 if (fread(freddy
, 1, 6, f
) != 6)
12 printf("couldn't read fred.txt\n");
21 f
= fopen("fred.txt", "r");
22 while ( (InChar
= fgetc(f
)) != EOF
)
28 printf("ch: %d '%c'\n", InChar
, ShowChar
);
32 f
= fopen("fred.txt", "r");
33 while ( (InChar
= getc(f
)) != EOF
)
39 printf("ch: %d '%c'\n", InChar
, ShowChar
);
43 f
= fopen("fred.txt", "r");
44 while (fgets(freddy
, sizeof(freddy
), f
) != NULL
)
45 printf("x: %s", freddy
);
52 /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/