aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2021-10-11 13:39:51 -0700
committerTrumeet <yuuta@yuuta.moe>2021-10-11 13:39:51 -0700
commitc090d474649fad9873e7e7231879d070ab062fc6 (patch)
treec875538bfad60cf1a598db7fdc45f1fe70249d5d
parent8e1fcfd0dd7dc8fa9f5450253d12e89dfafdd855 (diff)
downloadeasy-tg-c090d474649fad9873e7e7231879d070ab062fc6.tar
easy-tg-c090d474649fad9873e7e7231879d070ab062fc6.tar.gz
easy-tg-c090d474649fad9873e7e7231879d070ab062fc6.tar.bz2
easy-tg-c090d474649fad9873e7e7231879d070ab062fc6.zip
flush stdout after printing the prompt
-rw-r--r--example.c1
1 files changed, 1 insertions, 0 deletions
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);