CTRL-C not caught in DOS FB

General FreeBASIC programming questions.
Post Reply
clasqm
Posts: 1
Joined: Jun 06, 2020 8:27
Contact:

CTRL-C not caught in DOS FB

Post by clasqm »

The project is a text editor/lightweight IDE for DOS and Linux console: https://github.com/clasqm/clumsy/tree/clasqm

I want to use both F7 and CTRL-C for copying text, and this works fine in Linux. But when compiled in DOS, CTRL-C ends the program. I've had to #IFDEF that key out for now:

Code: Select all

....

''main loop
DO
	key = GETKEY
	' key substitutions
	IF key = 14 THEN key = 15359 ' ^N to F1
	IF key = 15 THEN key = 15615 ' ^O to F2
	IF key = 19 THEN key = 15871 ' ^S to F3
	IF key = 26 THEN key = 16127 ' ^Z to F4
	IF key = 18 THEN key = 16383 ' ^R to F5
	IF key = 24 THEN key = 16639 ' ^X to F6
	#IFDEF __FB_DOS__
	''nothing
	#ELSE
	    IF key = 3  THEN key = 16895 ' ^C to F7
	#ENDIF
	IF key = 22 THEN key = 17151 ' ^V to F8
	IF key = 8  THEN key = 17407 ' ^H to F9
	if key = 16 then key = 17663 ' ^P to f10
	if key = 6  then key = 17919 ' ^F to f11
	if key = 2 then key = 18175  ' ^B to f12
	IF key = 17 THEN key = 27    ' ^Q to ESC

	IF key > 255 THEN ''cursor keys
		key = key SHR 8 ''shifts the bits to the right
		SELECT CASE key
		
		....
		
So I can't ignore a CTRL-C keypress completely, just get it recognised as a normal, boring keypress. The linux version does this already, my problem is only with the DOS target.
angros47
Posts: 2326
Joined: Jun 21, 2005 19:04

Re: CTRL-C not caught in DOS FB

Post by angros47 »

I haven't tested it yet, but perhaps this can help?

http://www.delorie.com/djgpp/doc/libc/libc_144.html
Post Reply