Reputation: 821
When running your application over ST's build system it displays the console output only once the application has exited, it also posts the time it took to finish. Is there a way to show the output in realtime, like a normal console would?
cout < text < endl;
[do something for 5 secs];
After 5secs:
text
[Finished in 5.0s]
Upvotes: 0
Views: 306
Reputation: 821
OdatNurd's comment explained it perfectly. Buffering was indeed the culprit. I have never came in contact with the whole topic of how characters are buffered and flushed to outputs. Implementing a console is not as straight forward as I thought. In C setting
setbuf(stdout, NULL);
once or calling
fflush(stdout); (which is a bit cleaner)
after every printf solved everything!
Upvotes: 1