Re: Hangup
- Posted by "Graeme." <hmi at POWERUP.COM.AU> Jun 17, 1998
- 701 views
At 10:03 PM 6/16/98 -0400, Wally wrote: >Nice try, fellas, but it doesn't work. See my earlier message today about >unwarranted assumptions. > >Bob Pilkington: My program has several infinite loops in it, put there on >purpose. They begin with 'while 1 do' and every loop has an 'exit' in it. >The hangup occurred before any of these could have been encountered. >You said the 'allow_break(1)' is the default. I inserted it as the third >line in the main routine, right after the line that identifies the routine >and a 'clear_screen' command. If it is the default, I could have cleared >the hangup with a 'Ctrl-C' from the keyboard, but I couldn't. (The hangup >came immediately after the first request for keyboard input. I suspect it >is something sneaky dreamed up by one of those treacherous 'get' statements.) >Graeme: Your suggestion, to print something on the screen so that I can see >what's happening if anything, is a possibility. I haven't tried it yet, and >frankly I'm dubious, because of the location of the hangup. I suspect that >the program will never get to the special-print statement. I am assuming from this message that you still don't know *exactly* where the problem is. This *has* to be your first step. If you are suspicious of a particular line put: puts(1,"Before\n") before the line and: puts(1,"After\n") After the line. If you see "Before" but not "after" then your program is hanging on that line. If you see both massages (as I suspect) then you will have to look elsewhere. As somebody mentioned in one of the replys, CTRL-C will only be caught when you are checking for keyboard input. Which treacherous get statements are you talking about? Where is the input coming from? I suggest putting: if get_key() then end if inside all "while 1 do" loops to ensure CTRL-C is caught. Putting any kind of print to the screen inside these loops will also tell you straight away whether the program is actually hanging, or is stuck in an infinate loop (you will get your message printed repeatedly if it is stuck in a loop). HTH, Graeme. ----------------------------------------------------