From c090d474649fad9873e7e7231879d070ab062fc6 Mon Sep 17 00:00:00 2001 From: Trumeet Date: Mon, 11 Oct 2021 13:39:51 -0700 Subject: flush stdout after printing the prompt --- example.c | 1 + 1 file changed, 1 insertion(+) diff --git a/example.c b/example.c index fb05d98..c6fc0cd 100644 --- a/example.c +++ b/example.c @@ -11,6 +11,7 @@ static void read_input(const char *prompt, char *buf, unsigned int len) { printf("%s", prompt); + fflush(stdout); ssize_t size = read(0, buf, len + 1); if(size >= 1) buf[size - 1] = '\0'; printf("Read: %s\n", buf); -- cgit v1.2.3