D
D
Dmitry2014-08-16 17:38:13
C++ / C#
Dmitry, 2014-08-16 17:38:13

How to implement gcc realtime output?

Let me explain the question with the simplest example.
Let's say I do a loop to display the percentage of completion in the console.
for (i = 0; i < n; i++)
{
if (i%(n/10) == 0) printf("%d ", i);
}
In Visual Studio, the percentage of completion is displayed in real time, in Code:Blocks under gcc on Unix, the result is displayed all immediately after the loop has completed. How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Misha Krinkin, 2014-08-16
@Liro

If I understand your problem correctly, then you need to do fflush(stdout) after each printf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question