Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filesizefromfile nie moze zmieniac wskaznika na plik, wiec musisz najpierw zapisac, potem obliczac size
- a wiec musi to u Ciebie wygladac tak:
- if(f==NULL)
- {
- return -2;
- }
- int pozycja = ftell(f); //!
- fseek(f,0,SEEK_END);
- int wyn=ftell(f);
- fseek(f, pozycja, SEEK_SET); // !
- fclose(f);
- return wyn;
- filesizefrom path przekombinowane, wystarczy tak:
- if(fname == NULL)
- return -2;
- FILE *fp = fopen(fname, "r");
- if(fp == NULL) return -1;
- fseek(fp, 0, SEEK_END);
- int size = ftell(fp);
- fclose(fp);
- return size;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement