I am writing some console programs and I notice that sometimes when I use print() and my program is idle, not everything is printed out (the last few lines are missing).
Eventually something will happen and the lines do get printed, but often when I close the program the last few lines are not there.
So I did some digging and it looks like the stdout buffer is not always emptied unless certain conditions are met (new line? / line feed?).
so I have created a "myprintf()" function which wraps printf to do the following (in pseudo code):
printf(...);
fflush(stdout);
The question is, apart from the obvious extra function call overhead, is this going to slow my program down? I.e. is this a bad practice performance wise?