Page 1 of 1

is there a hot key to break an endless loop which is running

Posted: Fri Jul 11, 2014 8:11 am
by gremlin4
OK I'm a bit rusty, haven't used qb seriously for about 10 years and I've just turned 80
My question is:- If, in programming in Windows XP and QB, if I inadvertently insert an endless loop into my code and run it before I find out that it is endless, what can I do to stop execution WITHOUT losing the program status wot I've got up till then?

Re: is there a hot key to break an endless loop which is run

Posted: Fri Jul 11, 2014 8:53 am
by burger2227
Just use Ctrl + break to stop the program. Closing the window may close the QB IDE.

Re: is there a hot key to break an endless loop which is run

Posted: Fri Jul 11, 2014 2:46 pm
by gremlin4
OK, thanks a million, but, my keyboard (106 keys? seems a lot but i counted them twice)was made in china, has keys labelled in a sort of spanish shorthand.
CTRL I can find, but 'break' not.

Re: is there a hot key to break an endless loop which is run

Posted: Fri Jul 11, 2014 3:49 pm
by burger2227
LOL, my Dell keyboard doesn't either! Look for the Pause/Break button next to Scroll Lock.

Re: is there a hot key to break an endless loop which is run

Posted: Fri Jul 11, 2014 4:06 pm
by gremlin4
Bingo! I'm much indebted
ed

Re: is there a hot key to break an endless loop which is run

Posted: Sat Jul 12, 2014 6:44 am
by gremlin4
This page doesn't give me the option to unsubscribe

Re: is there a hot key to break an endless loop which is run

Posted: Sat Jul 12, 2014 8:28 am
by burger2227
Unsubscribe from what?

Uncheck Notify me when a reply is posted box if you don't want notifications.

Re: is there a hot key to break an endless loop which is run

Posted: Thu Sep 11, 2014 7:28 am
by michealey
One point I would like to append to this thread - is that if you are running QBASIC in DOSbox, the CTRL+Break does NOT work. However, there is a simple work-a-round. You can simply use CTRL+SCROLL LOCK - this performs the exact same function. :)

FYI

Re: is there a hot key to break an endless loop which is running

Posted: Mon Apr 10, 2017 3:45 pm
by W6UHQ
Hey, help another old guy out.. I'm with Gremlin4.... I've been in the trenches with COBOL, Assembler, FORTRAN etc.... and just a bit
of application programming with BASIC.... and I always (and probably always will) find that I have built me a cute little, tight, endless loop.
Most notable was going to top of page on a 1403 printer doing statements... ohhh, that was a fast printer... my question (beating a dead horse),
how can I get a QB64 program running under Win 10 to terminate... CTRL BREAK doesn't work, Control Scroll Lock doesn't work... (no such key on my Logitech K360 wireless keyboard).... however, the Windows famous "Nuclear Option" of terminating a running program works... a bit
of overkill.... was there updates on this subject?

Regards
Dennis/W6UHQ
Herald, CA

Re: is there a hot key to break an endless loop which is running

Posted: Fri Oct 18, 2019 12:14 am
by mikefromca
you could try CTRL+C but then its like CTRL+BREAK but you'd lose status.

In a Qbasic program you need to modify your endless loop from:

Code: Select all

Do
**insert whatever
Loop
To:

Code: Select all

Do
**insert whatever
if inkey$="X" then 
reset
system
end if
**insert whatever
Loop
but replace "X" with the actual key or scan code you want to use to force an exit out of your endless loop. I use "reset" and "system" instead of simply an "end" because "reset" closes all open files and "system" is a better way for me to end programs.

I know its not the most wonderful way to end a program but if your endless loop is rather complex, its a quick and dirty way to go