Open bp-dl opened 1 year ago
Rather than using a macro please use a dedicated function to wrap text output. I've never looked into this, but I suspect that there might be a simpler way to make the stdout automatically flush
A little googling shows that setvbuf(stdout, NULL, _IONBF, 0) can be used to make stdout unbuffered... just like stderr.
The stream stderr is unbuffered. The stream stdout is line-buffered when it points to a terminal. Partial lines will not appear until fflush(3) or exit(3) is called, or a newline is printed. This can produce unexpected results, especially with debugging output. The buffering mode of the standard streams (or any other stream) can be changed using the setbuf(3) or setvbuf(3) call.
When running stm8flash from within another IDE (such as Code::Blocks), any text that is output does not get displayed in the IDE until stm8flash exits (due to a lack of a flush). This commit fixes this by wrapping the text output calls in a macro that flushes the output stream each time. With this fix, the text output is displayed as stm8flash is running, and you are able to see it's progress in real time.