Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- long filesize(FILE *stream);
- int main(void)
- {
- char s = 'n';
- char poz;
- FILE *stream;
- int ga = 0;
- int prso;
- int f = 0;
- char c; int i=0;
- stream = fopen("da.txt", "r");
- fseek(stream, 0, SEEK_END);
- poz = getc(stream);
- prso = ftell(stream);
- printf ("som na konci %d pozicia je %c \n",prso, poz);
- fseek(stream, 0, SEEK_SET);
- prso = ftell(stream);
- printf ("som na zac %d \n",prso);
- while(feof(stream)==0)
- {
- fseek(stream,i,0);
- i+=1;
- c=getc(stream);
- printf("%c",c);
- f=f+1;
- if( s == c ) {
- ga = ga+1;
- }
- }
- printf ("%d \n",f);
- printf (" zhoda %d krat",ga);
- fclose(stream);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement