2021-02-02 12:57 AM
Works:
printf("hello world\n");
Does not work:
printf("goodbye world !");
I have tried to find the answer in gcc´without success.
Solved! Go to Solution.
2021-02-02 01:25 AM
That is a standard properity of stdout, it is buffered. Use stderr and output is immediate.Or fflush stdout.
2021-02-02 01:25 AM
That is a standard properity of stdout, it is buffered. Use stderr and output is immediate.Or fflush stdout.
2021-02-02 01:33 AM
It doesn't need to. But, by default printf is line buffered. This allows more efficient output if you override _write (instead of __io_putchar). It is also for historical reasons/compatability.
If you want to turn it off:
setvbuf(stdout, NULL, _IONBF, 0);
hth
KnarfB
2021-02-02 07:17 AM
Thanks alot.