Re: Loop
- Posted by Robert B Pilkington <bpilkington at JUNO.COM> Sep 08, 1998
- 799 views
>>Is there any command to cause a program to loop over and over until >control+c >>is pressed? > >I believe that putting the whole prog in this loop should do the >trick: > >integer k >while 1 do >-- program code or main procedure >k = get_key() >end while > >I think that ctrl+C will exit any Euph prog while it is looking for >keyboard input. At least ctrl+break should work. There may even be a >simpler way to do this but I can't test it on my mailer. Try this (untested) code: include machine.e -- allow_break() allow_break(0) -- CTRL-BREAK won't cause program to up and, -- for all intents and purposes, crash. integer key while 1 do key = get_key() -- Get input if check_break() then -- CTRL-BREAK or CTRL-C found exit -- Exit loop end if end while -- Exit gracefully here (restore video mode, close files, etc) _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]