Zortech problems

Peter da Silva peter at ficc.uu.net
Fri Feb 16 00:57:09 AEST 1990


In article <48a441bf.20b6d at apollo.HP.COM> nelson_p at 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. <peter at ficc.uu.net>.
/      \
\_.--._/ Xenix Support -- it's not just a job, it's an adventure!
      v  "Have you hugged your wolf today?" `-_-'



More information about the Comp.lang.c mailing list