flush input after displaying prompt line

master
bx 2022-04-03 19:12:17 +01:00
parent 1996e05ff6
commit 866f407472
1 changed files with 2 additions and 0 deletions

2
main.c
View File

@ -24,6 +24,7 @@ main(int argc, char **argv) {
while(1) { while(1) {
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
printf(" > "); printf(" > ");
fflush(stdout);
char *com = fgets(buf, sizeof(buf), stdin); char *com = fgets(buf, sizeof(buf), stdin);
for (int i = 0; i < sizeof(buf); i++) for (int i = 0; i < sizeof(buf); i++)
if (buf[i] == '\n') if (buf[i] == '\n')
@ -37,3 +38,4 @@ main(int argc, char **argv) {
} }