#include #include /* Broj znakova u datoteci. */ int main(int argc, char *argv[]) { FILE *fp; int ch, brojac = 0; if (argc == 1) { /* Nema imena datoteke! */ printf("Uporaba: %s ime_datoteke\n", argv[0]); exit(1); } if ((fp = fopen(argv[1], "r")) == NULL) { printf("Ne mogu otvoriti datoteku %s!\n", argv[1]); exit(2); } while ((ch = fgetc(fp)) != EOF) ++brojac; fclose(fp); printf("Broj znakova u datoteci %s = %d\n", argv[1], brojac); return 0; }