Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void main(void){
  5. File *file = fopen("/bibliothek/dokumente/Text.txt","r");
  6. int counter = -1;
  7. if(file != NULL){
  8. char c = 0;
  9. counter++;
  10. while((c = fgetc(file))!=EOF)
  11. if(c=="\n")
  12. counter++;
  13. printf("counter: %d",counter);
  14. }else printf("file ist NULL.\n");
  15. fclose(file);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement