Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
112
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 <ctype.h>
  3.  
  4. int main(int argc, char *argv[]) {
  5. FILE *f = fopen(argv[1], "r");
  6. FILE *temp = fopen("temp", "w+");
  7.  
  8. int ch = fgetc(f);
  9. int i = 0;
  10.  
  11. while (ch != EOF) {
  12. if (isascii(ch)) {
  13. fputc(ch, temp);
  14. }
  15. i++;
  16. ch = fgetc(f);
  17. }
  18.  
  19. fclose(f);
  20. fclose(temp);
  21.  
  22. f = fopen(argv[1], "w+");
  23. temp = fopen("temp", "r");
  24.  
  25. while ((ch = fgetc(temp)) != EOF) {
  26. fputc(ch, f);
  27. }
  28. fclose(f);
  29. fclose(temp);
  30.  
  31.  
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement