using the cp command in a program in os x
ok i have this program, i want to have it so the user types in the path of a file, and then the programs copies that file to another specified location. i have this so far:
Code:
#include <stdio.h>
int main()
{
char orig[50];
char dest[50];
printf("where is the file you would like to copy? start with desktop, with a \"/\" between each foler. \n");
scanf("%s",&orig);
printf("where would you like this file to be copied to? use the same format \n");
scanf("%s",&dest);
system("cp ~/%s ~/%s", orig, dest);
printf("DONE!");
return(0);
}
the problem is it comes up with an error that says "users/peter/%s isnt a directory"
how do i get it to recognize the string i have after it? or can i at all?
thanks