PDA

View Full Version : ANSI Escape Sequences OR Scan of keyboard



Samppa
10-24-2001, 09:00 AM
Hi there!
I have two questions:

1. I have tried the ANSI escape sequences towards
a xterm and hyper terminal and can get the text
reversed and in any given x,y position.

What I cant get working is the reassignments of
keys e.g
ESC [0;68;"dir";13p or
ESC [65;81p

Does not take any effect...Does anyone know
why or is there some clever steps need to be
taken in order to get this working?

2. How do I scan the keyboard in Unix for single
hits e.g. the arrow keys.
Using getch and similar commands needs a CR
before it takes effect.


Looking forward for your Answers!!

Cheers // Samppa

Engineer
10-24-2001, 09:11 AM
Try using kbhit() to monitor all keyboard strokes.

Samppa
10-24-2001, 09:17 AM
Isn't kbhit() used in PC environments?
If it is usable in unix as what do I have
to include?

/Samppa

Engineer
10-24-2001, 12:15 PM
It has been a very long time since I had to do something like that, so I am not too sure about the correct names, but it is the right direction.

kbhit() or something similar to it but with different name was a part of the "curses" library. The purpose of the "curses" library is to give you control of the console. I was using "curses" to create a visual interface inside the console.

Hope this helps.

P.S. When I get home, I see if I can find my old source using curses, and if I do, I will post the correct headers and functions to use. Cheers.