printf not printing to screen
Like @thejh said your stream seems to be buffered. Data is not yet written to the controlled sequence. Instead of fiddling with the buffer setting you could call fflush after each write to profit from the buffer and still enforce the desired behavior/display explicitly.