Thread: ANSI Escape Sequences OR Scan of keyboard

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    2

    Question ANSI Escape Sequences OR Scan of keyboard

    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

  2. #2
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125
    Try using kbhit() to monitor all keyboard strokes.
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    2

    kbhit()

    Isn't kbhit() used in PC environments?
    If it is usable in unix as what do I have
    to include?

    /Samppa

  4. #4
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125
    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.
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Better ANSI keyboard handling?
    By someprogr in forum C Programming
    Replies: 1
    Last Post: 02-01-2009, 11:54 AM
  2. Interpreting literal escape sequences from a file...
    By Sebastiani in forum C++ Programming
    Replies: 1
    Last Post: 07-08-2003, 02:00 PM
  3. Using escape sequences as user inputs
    By musayume in forum C Programming
    Replies: 4
    Last Post: 12-11-2001, 09:35 AM
  4. Escape sequences in VC++
    By emilyh in forum Windows Programming
    Replies: 7
    Last Post: 09-26-2001, 07:02 AM
  5. Escape Sequences
    By Me-Again-Again in forum C Programming
    Replies: 3
    Last Post: 09-05-2001, 06:24 AM