Why are my prints delayed until rn is sent?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

[WICED-SDK-2.2.1]

When I try to print to the uart, my prints do not come out until I send a

. Why?

0 Likes
1 Reply
Anonymous
Not applicable
stdin/stdout is buffered by default.

Buffering can be turned off as follows:

    setvbuf( stdin, NULL, _IONBF, 0 );

    setvbuf( stdout, NULL, _IONBF, 0 );

    setvbuf( stderr, NULL, _IONBF, 0 );

Alternatively, you can flush stdout as required using:

    fflush(stdout);

Example usage is shown in console.c in the iperf app.
0 Likes