unsigned int getoct (prompt,min,max,defalt);
unsigned int gethex (prompt,min,max,defalt);
char *prompt;
unsigned int min,max,defalt;
They begin by printing the string prompt as a message to the user. The user then types in a number of the appropriate form. If the number is valid and is within the range min to max, then it is returned as the value of getoct or gethex. If it is invalid or is out of range, then an error message is printed and the prompt-and-response cycle is repeated. If the user types just a carriage return, then the value defalt is assumed.
Getoct and gethex are identical, except in the manner in which the user's input is converted into an unsigned integer.
Getoct converts the input by assuming it represents a string of octal digits. Leading blanks and tabs are ignored; conversion stops at the first character which is not a legal octal digit. No signs (+ or -) are allowed.
Gethex converts the input by assuming it represents a string of hexadecimal digits. There may be leading blanks and tabs; in addition, the digit string may be preceded by "0x" or "0X", which will be ignored. The valid characters include "0" through "9", "a" through "f", and "A" through "F". Conversion stops at the first character which is not a legal hexadecimal digit. No signs (+ or -) are allowed.