I have a parent process and a child process (children are created using fork) some where in the parent process this code is defined :
FILE* pfile = fopen("log.txt","w");
while (1) {
serve child requests
fprintf (pfile,"some data\n");
}
fclose (pfile);
the problem is the last line of the code never gets executed because the infinite while loop does not terminate (this is how the program should act) .. so the file will never be closed and consecutively the written data wont be saved into the file.
How can i solve this problem ?
Any help would be greatly appreciated , Thanks