main()
{
FILE *file = fopen ("COMMAND.txt", "r");
FILE *file1 = fopen ("LOG.log", "a");
if (file != NULL)
{
char line [255]; /* Max line Size*/
while (fgets (line, sizeof line, file ) != NULL) /* Reading a line */
{
char first[10];
if (sscanf(line, "%9s", first) ==1)
{
fprintf(file1, "######\n"); /* it suppose to print on the first line only when u executed */
fprintf(file1, "%s\n", first);
}
printf(line); /* print on command prompt */
}
fclose (file);
fclose (file1);
}
else
{
perror ("Please check the file name and try again!");
}
}
having problem with printing a ###### as the first line only.
the idea putting ###### is seperating a new content with the old content.
with my code the ###### will print just before every single line