[net.lang.pascal] Turbo Pascal question

owen@rtp47.UUCP (Karl M. Owen) (08/11/85)

Is there a way in Turbo V3 to find out what the key was pressed if
the 'keypressed' function returns true?

I want to take different actions depending on what the key is, but I don't
know how to do a single character read.

					Thanks,
					Karl


				Karl M. Owen
				Data General, RTP, NC
				...!seismo!mcnc!rti-sel!rtp47!owen

ericksen@unc.UUCP (James P. Ericksen) (08/13/85)

> Is there a way in Turbo V3 to find out what the key was pressed if
> the 'keypressed' function returns true?
> 
> I want to take different actions depending on what the key is, but I don't
> know how to do a single character read.
> 

I assume your problem is that you are using
	Read (input, c);	(* c is a character variable *)

which waits for a carriage return before proceeding (input is buffered).
For unbuffered keyboard input, use
	Read (kbd, c);

By the way, the best way around Turbo's brain damaged check-for-break-key
(which can cause the character detected by the Keypressed function to dis-
appear) is to disable checking for break key by putting
	(*$C-*)
at the start of your program (necessary for sane operation of any program
which reads the keyboard).


Jim Ericksen
Dept of Comp Sci
UNC Chapel Hill