Save a file with a name in a variable?
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.
FILE *original, *copy;
char c, name;
original = fopen ("C:\\example\\zippedData", "r");
printf ("File name?"); //Input name to save the file//
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 != ';')
else putc (',', copy);
Im sorry if my English it's not so good... it's not my native language