Guest User

Untitled

a guest
Nov 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main (int argc, char * argv[]) // taking files
  5. {
  6. FILE * fp;
  7. FILE * fp2;
  8. int c;
  9. .
  10. . // checking possible problems
  11. .
  12. while ( (c = fgetc(fp)) != EOF){ // copying one file to another one
  13. fputc (c, stdout);
  14. fputc (c, fp2);
  15. }
  16.  
  17. fclose(fp);
  18. fclose(fp2);
  19. fp = NULL;
  20. fp2 = NULL;
  21.  
  22. return EXIT_SUCCESS;
  23. }
  24.  
  25. char buffer[4096];
  26. while (fgets(buffer, sizeof(buffer), fp) != 0)
  27. {
  28. fputs(buffer, stdout);
  29. fputs(buffer, fp2);
  30. }
Add Comment
Please, Sign In to add comment