Below is a section of coding that I have done. My problem is that I want to repeat the process which I know how to do however, I want to be able to write the data beside the orginal data which was already written to the file as is a table format. How can I do this with the code below.




static void
MyCopyFile(char *FromFile, char *ToFile)
{
FILE *from;
FILE *to;
char FileBuf[256];

if ((from = fopen(FromFile, "r")) != NULL)
{
/* THE "a" WILL APPEND TO THE FILE, IF YOU WANT TO CREATE A NEW FILE, USE "w" */
if ((to = fopen(ToFile, "a")) != NULL)
{
while (fgets(FileBuf, 255, from) != NULL)
{
fputs(FileBuf, to);
}
fclose(to);
}
else
printf("Cannot open %s\n", ToFile);
fclose(from);
}
else
{
printf("Cannot open %s\n", FromFile);
}
}