Re: how do I do a line input in Euphoria?
- Posted by Mike Fowler <stoner at NELSUN.GEN.NZ> Oct 10, 1997
- 641 views
-> 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? this is what I usually do... but it is (i think) bad programming... oh well... i'm only an amatuer :) this code is _totally_ untested... -- code starts here include get.e -- for wait_key() constant EXIT_KEYS = {13} sequence line -- the line we're creating integer char -- the last pushed keyboard character pushed char = wait_key() while find(char, EXIT_KEYS) = 0 do -- should it be 0 or -1 ??? line = append(line, char) -- add the character to the line char = wait_key() -- wait for next keypress end while puts(1, "You Typed:\n" & line) -- end of code yes, its ugly, but it works :) Mike Fowler - mike.fowler at nelsun.gen.nz o__ --- _,>/'_ --- (_) \(_) ---