Functions
contrib/mul/mbl/mbl_read_str.h File Reference

Asks question and waits for an answer. 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.

Detailed Description

Asks question and waits for an answer.

Author:
Tim
Date:
Based on code written 7-May-92
    Modifications
     Converted to vxl by gvw, soblamemewhydontcha!
     1.1   Tim   New version 4-Nov-98
   

Definition in file mbl_read_str.h.


Function Documentation

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.

Parameters:
replySpace for reply
max_str_lenLength of space for reply
q_strA question
default_strDefault answer
Returns:
reply: The answer or a default

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.