Ask String question. More...
Go to the source code of this file.
Functions | |
char * | mbl_read_str (char *reply, int max_str_len, const char *q_str, const char *default_str) |
Asks question and waits for an answer from standard input. |
Ask String question.
Copyright: (C) 1994 Victoria University of Manchester
Definition in file mbl_read_str.cxx.
char* mbl_read_str | ( | char * | reply, |
int | max_str_len, | ||
const char * | q_str, | ||
const char * | default_str | ||
) |
Asks question and waits for an answer from standard input.
If the answer is a non-empty string, returns it. If the answer is an empty vcl_string (return) then returns default.
reply | Space for reply |
max_str_len | Length of space for reply |
q_str | A question |
default_str | Default answer |
Example: a)
const int N_max_len = 20; char* Name[N_max_len]; mbl_read_str(Name,N_max_len,"Enter Name","Fred");
b) If default_str = current reply, then reply is only overwritten if a different vcl_string given.
const int N_max_len = 20; char* Name[N_max_len]; strcpy(Name,"Freddy"); mbl_read_str(Name,N_max_len,"Enter Name",Name);
Definition at line 12 of file mbl_read_str.cxx.