slow-cp.c (472B)
1 #include <stdio.h> 2 3 int main(int argc, char** argv){ 4 5 if(argc != 3){ 6 printf("Usage: slow-cp {source} {destination}"); 7 return -1; 8 } 9 10 char* source; 11 char* destination; 12 13 source = argv[1]; 14 destination = argv[2]; 15 16 17 FILE* file = fopen(source, "r"); 18 FILE* fdest = fopen(destination, "w"); 19 20 int c; 21 22 while((c = getc(file)) != EOF){ 23 fputc(c,fdest); 24 } 25 26 printf("File copied successfully\n"); 27 28 return 0; 29 }