I have this piece of code; it works when you directly write the arguments to system(), and doesn’t work if you pass the arguments to it. Any help please?
char dest[100];
char file[50];
char dir[100];
printf("Enter source path: ");
scanf("%s", dir);
printf("Enter filename: ");
scanf("%s", file);
printf("Enter destination path: ");
scanf("%s", dest);
system("move \"c:\\users\\putty.exe\" g:\\ \n" ); /* <--works */
system("move \"%s%s\" %s", dir,file,dest); /* <--doesn't work */
You can try this