Advertisement
KonekoChi

Untitled

Feb 25th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define DELIM " \n,.;:!?'"
  4.  
  5. int main()
  6. {
  7. FILE *fin, *fout;
  8. fin = fopen("files1.txt", "r");
  9. fout = fopen("files1_o.txt", "w");
  10. char s[128], *p;
  11. while(fgets(s, 128, fin))
  12. {
  13. for (p=strtok(s, DELIM); p; p=strtok(NULL, DELIM))
  14. if (*p=='a')
  15. fprintf(fout, "%s ", p);
  16. }
  17. fprintf(fout, "\n");
  18. fclose(fin);
  19. fclose(fout);
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement