printf() without '\n' doesn't work in libev [duplicate]
问题 This question already has answers here : Why does printf not flush after the call unless a newline is in the format string? (10 answers) Closed 3 years ago . Post the code first: #define EV_STANDALONE 1 #include <stdio.h> #include "ev.c" ev_timer timeout_watcher; struct ev_loop* loop; static void timeout_cb (EV_P_ ev_timer *w, int revents) { // puts("timeout"); printf("timeout"); ev_timer_again(loop, w); } int main (void) { printf("hello, world."); loop = EV_DEFAULT; ev_timer_init (&timeout