getputc.c | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include <ctype.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *args[]) { FILE *vhod, *izhod; int c; if (argc != 3) exit(1); vhod = fopen(args[1], "r"); izhod = fopen(args[2], "w"); if ((vhod != NULL) && (izhod != NULL)) { while (!feof(vhod)) { c = getc(vhod); c = toupper(c); putc(c,izhod); } fclose(izhod); fclose(vhod); printf("OK \n"); } else printf("Napaka!\n"); return 0; } |