Xref: utzoo comp.lang.c:25948 comp.sys.ibm.pc:44483 comp.sys.ibm.pc.programmer:1 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!wuarchive!swbatl!texbell!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c,comp.sys.ibm.pc,comp.sys.ibm.pc.programmer Subject: Re: Zortech problems Summary: Use kbhit(). Message-ID: Date: 15 Feb 90 13:57:09 GMT References: <48a441bf.20b6d@apollo.HP.COM> Reply-To: peter@ficc.uu.net (Peter da Silva) Followup-To: comp.sys.ibm.pc.programmer Distribution: usa Organization: Xenix Support, FICC Lines: 46 In article <48a441bf.20b6d@apollo.HP.COM> nelson_p@apollo.HP.COM (Peter Nelson) writes: > What if I have a 1-hour program that I want to stop after 5 > minutes because I don't like the way it's turning out? I could > type Break or ctrl-C except that once Zortech enters graphics > mode it disables this feature! Good for them. The way most C compilers implement 'BREAK' is a total sham. DOS does not provide the support to do the job right, so DOS programs have to poll the keyboard periodically looking for ^C (yes, I know it's a *little* more complicated than that, but it comes down to checking for ^C periodically). Since you're doing that polling anyway, why not do something like: while(stuff is going on) { do useful work(); if(kbhit()) { switch(getch()) { case CTRL('C'): set exit flag; ... } } if(exit flag) break; } clean_up_after_yourself(); After all, this is what you're doing anyway. Why not do it explicitly? > And, as far as I can tell, none > of the "get" string or character functions (getc, getch, etc) > Zortech supplies will return without *waiting for a keystroke*, > so I can't write a routine which periodically checks to see if > anyone has typed "quit" or something from the keyboard. See above. kbhit() is a handful of lines long. If Zortec doesn't provide one, a few minutes perusal of your DOS manual should handle it. I'm directing followups to comp.sys.ibm.pc.programmer. Congratulations on being the first resident of the new group. > Zortech itself had no helpful suggestions on this either except to > reboot the machine (gee, thanks) but one of their experts is > going to take a closer look at this issue. Sounds like Zortech needs a few new experts. -- _--_|\ Peter da Silva. +1 713 274 5180. . / \ \_.--._/ Xenix Support -- it's not just a job, it's an adventure! v "Have you hugged your wolf today?" `-_-'