Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <math.h>
  5.  
  6. int main(int argc, char**argv)
  7. {
  8. FILE*f;
  9. f = fopen(argv[1], "r");
  10. char file_string[100];
  11. int counter;
  12.  
  13. while(1)
  14. {
  15. fgets(file_string, 100, f);
  16. counter = 0;
  17.  
  18. for (int i = 0; i < (int)strlen(file_string); i++)
  19. if (file_string[i] == ' ')
  20. counter++;
  21.  
  22. if (counter < 3)
  23. printf("%s", file_string);
  24. if (feof(f))
  25. break;
  26. }
  27.  
  28. fclose(f);
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement