I am new to file operations like write/read in C. Is there a solution to write all printf() which is below, to my output text file? After execution I was not able to write all the lines to my text file.
for(i=0;i < n;i++)
if(i!=startnode)
{
outputFile = fopen(myOutputFile, "w");
printf("\nCOST of %d = %d", i, cost[i]);
printf("\nTRACE = %d", i);
j=i;
do
{
j=pred[j];
printf(" %d", j);
}
while(j!=startnode);
}