getc.c | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <stdio.h> #include <stdlib.h> int main(int argc, char *args[]) { if (argc != 2) exit(1); FILE *d; if ((d = fopen(args[1], "r")) == NULL) exit(2); int c; while ((c = getc(d)) != EOF) putchar(c); fclose(d); return 0; } |