473,387 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

key mapping for command-line tools

Hi. I wonder if anyone could point me to a simple key mapping example
for a command-line application. I would like to map the up and down
arrow keys in my application to a couple of command history functions,
but I don't know how to interact with the terminal (any terminal) to do
this. If I use getc to trap an arrow key press I just get an ESC (27),
and of course I have to wait for a newline to do anything with it.
I've been looking over vim and mysql source for an answer, but it's a
lot of code to wade through. Thanks for any tips.

Apr 7 '06 #1
4 1699
pa*****@gmail.com opined:
Hi. I wonder if anyone could point me to a simple key mapping
example
for a command-line application. I would like to map the up and down
arrow keys in my application to a couple of command history
functions, but I don't know how to interact with the terminal (any
terminal) to do
this. If I use getc to trap an arrow key press I just get an ESC
(27), and of course I have to wait for a newline to do anything with
it. I've been looking over vim and mysql source for an answer, but
it's a
lot of code to wade through. Thanks for any tips.


Ask in the group dealing with your particular environment. Stndard C
knows nothing about keys...

--
Only a fool fights in a burning house.
-- Kank the Klingon, "Day of the Dove", stardate unknown

<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>

Apr 7 '06 #2
pa*****@gmail.com wrote:
Hi. I wonder if anyone could point me to a simple key mapping example
for a command-line application. I would like to map the up and down
arrow keys in my application to a couple of command history functions,
but I don't know how to interact with the terminal (any terminal) to
do this.


Many implementations use a "scan code" system, multiple character
values translate into one key. Try searching for your platform name and
"scan codes". That's about the best we can do for you.


Brian
Apr 7 '06 #3
pa*****@gmail.com wrote:
Hi. I wonder if anyone could point me to a simple key mapping example
for a command-line application. I would like to map the up and down
arrow keys in my application to a couple of command history functions,


<snip>

This isn't possible in standard C which is what we discus here, so you
will have to ask in a group dedicated to your implementation.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
Apr 7 '06 #4
Thanks... now I have a better idea where to look. But sorry for the
off-topic post.

Apr 7 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Abraham Khalil | last post by:
With all the Menu items, toolbar items and popup items that can total to about 50-75 choices in a gui design, what the 'easiest' way to map the action names with the class to call. Like to use...
1
by: Josef Schneider | last post by:
Given: Data.oledb source, and a Data.odbc target The oledb data is read into a dataset. (1) Is there an easy way to copy that dataset to the target datasource ( I can look through the...
0
by: Vladimir | last post by:
How I can get the information about mapping path of the substituted drive from C# code. For example I have created the substitution using the command: C:\>subst r: "C:\Program Files" C:\>subst...
1
by: Trent | last post by:
Hello, all. I'm having problem creating subcription sets for replication on UDB DB2 Express Edition 8 fp5 on Windows 2000 Server. I could not add member to the sets on the Source-To-Target...
5
by: Kevin C | last post by:
I was curious to know what some developers out in the industry are doing when it comes to exposing Data access logic, specifically persistence. This is assuming that your not using an O/R framework...
1
by: John Smith | last post by:
Hello all: Is there a way to map a drive programatically in .NET? Thanks, - John -
2
by: aarepasky | last post by:
I am getting the the message on the command: cm.ExecuteNonQuery(); Complete message is: No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider...
13
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I am actually trying to get the UNC path of the main module of a process running from a mapped drive, and I am trying to do this from a service. The ProcessModule class only provides the full path...
5
by: alan | last post by:
Hello world, I'm wondering if it's possible to implement some sort of class/object that can perform mapping from class types to strings? I will know the class type at compile time, like so:...
10
by: =?Utf-8?B?Z3JlYXRiYXJyaWVyODY=?= | last post by:
Sorry about that previous one. I pressed enter too early. How does one go about mapping a network drive in C#. i know you use MapNetworkDrive in scripting languages, but i'm not sure how to do it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.