FILE *f, *destination; f = fopen(name, "r"); destination = fopen(path, "a+"); if(f == NULL){ printf("Can 't copy the file.\n"); return -1; } if(destination == NULL){ printf("Can 't copy the file.\n"); return -1; } char c; while((c = fgetc(f)) != EOF){ fprintf(destination, "%c", c); }