Flush buffer created by printf retargeting

Ah I solved it! For some reason, calling fflush on the FILE * from fdopen does not flush stdout. However, mbed properly defines stdout so that calling fflush(stdout) properly does flush the buffer from printf.

So the following code will flush immediately:

printf("Partial line");
fflush(stdout);