OS1/directories/input.c

22 lines
286 B
C
Raw Normal View History

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