Two questions
- Posted by rforno at tutopia.com Sep 02, 2001
- 555 views
This is a multi-part message in MIME format. ------=_NextPart_000_000D_01C133FC.12456F00 charset="iso-8859-1" Rob: I find slightly annoying the need to insert a whitespace character in a file that has to be read by means of get(), because to create such a file you would need two instructions for each object, namely: print(file, object) puts(file, "\n") (or puts(file, " ") ) Maybe there is an alternative to this that I don't know. Another subject: I'm having problems with the function check_break(). When I use it in the attached stripped down version of one of my programs, and I type ^C, no message is printed in spite that ^C appears on the screen. Moreover, if I type ^2 (that I don't know why it behaves similarly to ^C), two ^C are printed on the screen the first time, and the message appears the second time. Then, while typing ^2, it cycles between these two outputs. ------=_NextPart_000_000D_01C133FC.12456F00 Content-Type: application/octet-stream; name="xx.ex" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xx.ex" include get.e include file.e function Get_key() --Waits for a keypress integer c while 1 do c = get_key() if c != - 1 then exit end if end while return c end function procedure entry() sequence input_line integer c allow_break(0) while 1 do --Until exit input_line = {} --Initialize reserve of input characters if check_break() then --Advise operator printf(1, "%s\n", {"To quit, press return"}) end if c = Get_key() --Get the first keypress if c = 13 then --If empty input line exit end if end while end procedure entry() --Execute main procedure ------=_NextPart_000_000D_01C133FC.12456F00--