Hi, i need to know how to do something that might be really easy, but i just don't know how.
The thing is that i open a file allocated, for example in," C:\example " and i need to save it in another path such as " C:\example\folder"
But when i open the file it has a previous name (zippeddata.txt), and in the program i ask the user to enter a name to save the modified file, in the new path.
The thing is that i cant make it work when the user writes the new name of the file, i dont know the code to do that.
Code:
#include <stdio.h>
main() {
FILE *original, *copy;
char c, name[20];
original = fopen ("C:\\example\\zippedData", "r");
printf ("File name?"); //Input name to save the file//
scanf ("%s",name);
printf ("%s\n", name);
copy = fopen ("C:\\example\\folder\\ *** I DON'T KNOW WHAT GOES HERE *** .txt","w"); //Creates new file, which must have the "name" variable//
while ((c = getc(original)) != EOF)
if (c != ';')
putc(c, copy);
else putc (',', copy);
fclose (original);
fclose (copy);
return 0;
}
Please Help!!
Im sorry if my English it's not so good... it's not my native language
Cheers!