>> I want to be able to use all 12 Function keys in my program.
Can someone help me maybe on this one?
I guess that those function keys also have an ascii number.
But so far I haven't seen none of the funtion keys in my ascii chart.
<Offtopic>
Depending on the terminal type, function keys usually generate a specific
sequence of characters, often starting with ESC (0x1b). For example, on my
terminal, the F1 key generates the string "\x1b\x5b\x31\x31\x7e"
Reading function keys is something very system- and OS-specific and is not
possible with only ANSI-C; you might want to ask this question in the
appropriate newsgroup that discusses programming on unix/linux. You also
might want to look into the 'curses' and/or 'termcap' libraries, which are
specially designed to handle keyboard and screen IO on unix systems.
It is possible to read the characters generated by a function key
in a system-independent manner. To figure out what sequence of
characters go with what keys, you can ask the user to "Press the
F1 key followed by the key used to end a line of input (typically
Enter or Return)", then fgets() (possibly multiple times if your
initial buffer wasn't long enough) the result and save it. This
will screw up if the function keys generate something interpreted
as a newline. Repeat for other function keys that you will use.
Distinguishing the function key from an individually-typed sequence
that matches it isn't practical (most programs that do this depend
on character-at-a-time I/O and timing). On many systems, this
reduces to "don't try to use the ESCAPE key as something the user
will type by itself".
C also doesn't have non-blocking or character-at-a-time I/O, so the
user has to press ENTER (or whatever) to finish a line of input
before it's visible to the program. This severely messes up any
idea you might have about the user pressing F1 and having a help
screen appear immediately.
The "termcap" database doesn't do anything that can't be done in
ANSI C, although the data contained in it is terminal-specific.
ANSI C allows getenv("TERM") which can be used as a key into the
database to look up the sequences generated by various function
keys on the terminal (or emulation thereof) that the user is using.
Gordon L. Burditt