Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<malloc.h>
- struct at {
- char znak;
- struct at *sljed;
- };
- typedef struct at atom;
- void maksimum(int *max, FILE *in);/*
- int ucitaj(atom *glava, FILE *ulaz);
- void trazi(atom *glava, FILE *izlaz);*/
- int main(int argc, char **argv)
- {
- FILE *ulaz, *in, *izlaz;
- char c;
- atom *glava;
- int *max;
- *max=0;
- if (argc!=4) {printf("Greska: Krivi poziv funkcije!"); exit(1); }
- ulaz=fopen(argv[1], "r");
- in=fopen(argv[2], "r");
- izlaz=fopen(argv[3], "w");
- if (ulaz==NULL || in==NULL || izlaz==NULL) {
- printf("Greska: Ne mogu otvoriti datoteku!");
- exit(1);
- }
- //printf("kul");
- maksimum(max, in);
- /* while (ucitaj(glava, ulaz)){
- trazi(glava, izlaz);
- cisti(glava);
- } */
- return 0;}
- void maksimum(int *max, FILE *in){
- int k=0;
- char c;
- while ((c=fgetc(in)) != EOF) {
- printf("x");
- printf("%c", c);
- k++;
- printf("x");
- if (k > *max) *max=k;
- printf("x");
- if (c=='\n') k=0;
- printf("x");
- }
- *max-=2;
- printf("max = %d", *max);
- }
Add Comment
Please, Sign In to add comment