Re: how do I do a line input in Euphoria?
- Posted by Ad Rienks <Ad_Rienks at COMPUSERVE.COM> Oct 10, 1997
- 835 views
>At 11:17 PM 10/9/97 -0700, you wrote: > >ya know, up till now >I've only needed single character inputs, or have >been using >specialized libraries for string and number input (like Dave >>Cuny's GUI and jiri's font package) I'm writing a program in >text mode, >and I can't find how to do a simple string or >numeric input in the >manuals. How do I do it? > >Just add up a whole bunch of single character inputs until they >press a certain key, say, the "ENTER" key. = Drawback of that method is that there is no editing possible during input= =2E I myself mostly stick to the following: include get.e function input(sequence prompt) -- simple numeric input routine object number puts(1, prompt) number =3D get(0) number =3D number[2] return number end function -- input function input_string(sequence prompt) -- simple string input routine sequence string puts(1, prompt) string =3D gets(0) return string[1..length(string)-1] end function -- input_string Certainly these functions are not foolproof either. Add your own validity= tests and maybe a clear_to_end_of_line() and some loops to check the inpu= t and ask for new input if necessary. Sincerely, Ad Rienks email Ad_Rienks at compuserve.com writing at 1:44 , = on zaterdag 11 oktober 1997 Using EMail Assist for WinCIM