LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-27-2005, 04:33 AM   #1
himateja
LQ Newbie
 
Registered: May 2005
Posts: 2

Rep: Reputation: 0
problem recognising key strokes


In my application i have a command prompt..at that command prompt i wud like to facilitate the usage of up and down keys so that the user can get the previous typed queries instead of writing back the whole thing...please tell me how to recognize the up and down keys...is it with the ASCII values?
 
Old 05-27-2005, 04:47 AM   #2
saurabh_sahni
LQ Newbie
 
Registered: Apr 2005
Location: Indore, India
Distribution: Mandrake 10.0
Posts: 7

Rep: Reputation: 0
simply store the commands in a file when they are executed... and retrive them when user preses arrow keys.. to detect pressing of keys use following function:

void getkey()
{
union REGS i,o;
i.h.ah=0;
int86(22,&i,&o);
scan=o.h.ah;
ascii=o.h.al;
}
if(ascii==0 && scan==72) //UP key
if(ascii==0 && scan==80) //down key
 
Old 05-27-2005, 05:00 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
No, that's not with ascii codes, but with key-codes the terminal recieves. The ncurses library privodes functions to read these codes.
 
Old 05-27-2005, 05:54 AM   #4
himateja
LQ Newbie
 
Registered: May 2005
Posts: 2

Original Poster
Rep: Reputation: 0
hi saurabh thanks for the answer ..but are there any header files to be included because the compiler doesnt recognise int86 ........and there is no help from man command also....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with cedega not recognising graphics cards Snerkel Linux - Software 0 06-07-2005 12:57 PM
Problem recognising a CD drive steve_m Linux - Hardware 4 09-25-2004 09:21 PM
Identifying and Mapping/Binding key strokes mikeyt_333 Linux - General 3 10-02-2003 10:42 PM
Repeating key strokes toxic53 Linux - General 1 12-11-2002 09:06 PM
Problem Recognising NIC gladhe8r Linux - Networking 2 08-11-2002 11:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration