How about :
Code:
int getint(FILE *fp, char item[])
{
int n;
int min;
int max;
fscanf(fp, "%d%d", &min, &max);
printf("Enter the %s: %d to %d: ", item, min, max);
scanf("%d%*c", &n);
while (n < min || n > max)
{
message("\nChoice not in range.\a");
printf("Enter the %s: %d to %d: ", item, min, max);
scanf("%d%*c", &n);
}
return(n);
}
Make a similar change in getreal() but use floats/doubles instead of ints.
This will avoid a lot of redundant code - since each call to get* has an fscanf into variables which are used just in that function, move the call there. It'll clean up the calling code significantly.