OS1/movies/input.c

22 lines
286 B
C
Raw Permalink Normal View History

#include "input.h"
int integer_input(char* val) {
int num;
char *error = "";
do {
2023-10-14 16:57:09 -07:00
printf("%s\n%s",error, val);
fflush(stdout);
char buf[128];
read(STDIN_FILENO, buf, 127);
num = atoi(buf);
2023-10-14 16:57:09 -07:00
error = "\nInput Error, try again.";
} while(!num);
return num;
}