I have 2 text files which I have opened up, and I want to copy the contents of both text files into an output file. Here is what I have got so far.
printf("\nWhat is the name of the output file you want to use? (with file extension)\n");
gets_s(thirdfilename);
fopen_s(&text3, thirdfilename, "w");
while (text3 == NULL)
{
printf("\nThis file does not exist, please re-enter the name of the output file you want to use (with file extension)\n");
gets_s(thirdfilename);
fopen_s(&text3, thirdfilename, "w");
}
if (text3 != NULL)
printf("\nYou have successfully opened '%s'\n", thirdfilename);
I'm not sure whether to use a while loop to copy the text into the third file, or to use a for loop. I have already created and opened up my first two texts before the code that I have stated above. Any help is much appreciated.