C
Cliff
Hi all. I'm working on a program that writes a line of text to a file
during each iteration of a for loop. This for loop may run for quite a
while and sometimes I would like to stop it ("Ctrl-C") before the
program finish executing. My problem is the data does not get written
to file until the entire program executes.
Here's the relevant code:
for(n=0;n<iter;n++){
sprintf(line,"%d\t%e\t%e\t%e\t%e\t%e\t%e\t%d\n", n2, startV, stopV,
mm.maxV, mm.maxI, mm.minV, mm.minI, DPNT);
fprintf(summary_file, line);
}
Any help with the code or explanation as to why this happens would be
appreciated.
Cliff
during each iteration of a for loop. This for loop may run for quite a
while and sometimes I would like to stop it ("Ctrl-C") before the
program finish executing. My problem is the data does not get written
to file until the entire program executes.
Here's the relevant code:
for(n=0;n<iter;n++){
sprintf(line,"%d\t%e\t%e\t%e\t%e\t%e\t%e\t%d\n", n2, startV, stopV,
mm.maxV, mm.maxI, mm.minV, mm.minI, DPNT);
fprintf(summary_file, line);
}
Any help with the code or explanation as to why this happens would be
appreciated.
Cliff