Advertisement
evage

Untitled

Apr 8th, 2022
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     FILE *source, *dest;
  7.     char dir_source[20], dir_dest[20];
  8.     printf("Example of file path: C:\\file.txt\n");
  9.     printf("Enter source file path\n");
  10.     scanf("%s", dir_source);
  11.     printf("Enter destination file path\n");
  12.     scanf("%s", dir_dest);
  13.     source = fopen(dir_source, "r");
  14.     dest = fopen(dir_dest, "w");
  15.     while (!feof(source))
  16.     {
  17.         char ch = getc(source);
  18.         if (ch == '\n' or ch == EOF) continue;
  19.         putc(ch, dest);
  20.     }
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement