🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #13585

Problem with Ctrl-Break

#13585
From: Nhan Tran
Date: Fri, 09 Oct 1992 19:26
31 lines
1277 bytes
I have a routine in Turbo-C. It detects user's keystroke with bioskey().
I want to detect Ctrl-C but ignore Ctrl-Break.

getkey()
{
	while (!bioskey(1))
		;
	return (getch());
}

It works fine for Ctrl-C. However, if I press Ctrl-Break, the program hangs.

When I change 
			while (!bioskey(1))
to
			while (!kbhit())

then both Ctrl-C & Ctrl-Break show ^C on screen and terminate the program.

When I use ctrlbrk() to set a new control-break handler, pressing Ctrl-C
or Ctrl-Break won't terminate the program but leave ^C on the screen.
Moreover, I cannot detect Ctrl-C this way (using kbhit())

Using bioskey() + ctrlbrk(), I can detect Ctrl-C, but again Ctrl-Break hang
the program.

Somehow bioskey() doesn't work with Ctrl-Break. 
Does anyone have any solution?

N. Tran.
Technical Details
Message-ID: <BvvCoM.3@peora.sdc.ccur.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!fang!tarpit!peora!tran

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.ibm.pc,comp.sys.ibm.pc.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!fang!tarpit!peora!tran
From: tran@peora.sdc.ccur.com (Nhan Tran)
Subject: Problem with Ctrl-Break
Message-ID: <BvvCoM.3@peora.sdc.ccur.com>
Date: Fri, 9 Oct 1992 19:26:45 GMT
Organization: Concurrent Computer Corp, Orlando, Fl
Followup-To: poster
Lines: 31