In file input.h:

int get_bool

(int* retbool, int msg, int err, int def, int defval)

Get a boolean (yes or no) answer.

Documentation

Get a boolean (yes or no) answer.

Works just like getnumber(). Prompts msg, asks for Y/N answer, prompts err if bad response, optionally prompts def with a default value (0 or 1) of defval.

Parameters:
retbool - pointer to an int. This is written to if a valid (or default) answer is provided. The variable will be set to one if `yes' was chosen, and to zero if the answer was `no'.
msg - is the short prompt number to display. This should give the user a brief idea of what is expected of them. This prompt should belong to the current message block. It will not be displayed if the value is zero, but please don't do this as it makes things look inelegant.
err - the error prompt to display. Specify zero to disable error printing.
def - is the user prompt used when defaults are used (which must belong to the current prompt block). This is usually a short string added to the short menu prompt, and looks like `(Enter=%c)' or ` [%d]'. The format specifier gets either `Y' or `N', depending on the value of defval. Use a zero to disable printing of defval where, for instance, the default value is printed by msg.
defval - is the default value for when the user presses Enter. Non-zero values stand for yes; zero is no.
Returns:
Zero if X entered; one is returned if the answer was valid, in which case it is stored in retbool (1 for `yes', 0 for `no'). A value of -1 implies that INF_HELP was set and the user entered ` ?'.

Alphabetic index



This page was generated with the help of DOC++.