#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; } char* string_input(char* val) { char* string = malloc(sizeof(char) * 1000); printf("%s", val); fflush(stdout); ssize_t n = read(STDIN_FILENO, string, 1000); string[n - 1] = '\0'; return string; }