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

Ask String question. More...

#include "mbl_read_str.h"
#include <vcl_cstdio.h>
#include <vcl_cstring.h>

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

Ask String question.

Copyright: (C) 1994 Victoria University of Manchester

Definition in file mbl_read_str.cxx.


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.