Advertisement
Lubino41

Untitled

Dec 5th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. long filesize(FILE *stream);
  4.  
  5. int main(void)
  6. {
  7. char s = 'n';
  8. char poz;
  9. FILE *stream;
  10. int ga = 0;
  11. int prso;
  12. int f = 0;
  13. char c; int i=0;
  14. stream = fopen("da.txt", "r");
  15.  
  16. fseek(stream, 0, SEEK_END);
  17. poz = getc(stream);
  18. prso = ftell(stream);
  19.  
  20. printf ("som na konci %d pozicia je %c \n",prso, poz);
  21.  
  22. fseek(stream, 0, SEEK_SET);
  23. prso = ftell(stream);
  24. printf ("som na zac %d \n",prso);
  25.  
  26. while(feof(stream)==0)
  27. {
  28.  
  29. fseek(stream,i,0);
  30. i+=1;
  31. c=getc(stream);
  32. printf("%c",c);
  33. f=f+1;
  34. if( s == c ) {
  35. ga = ga+1;
  36. }
  37. }
  38. printf ("%d \n",f);
  39. printf (" zhoda %d krat",ga);
  40. fclose(stream);
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement