readkey(3alleg4) Allegro manual readkey(3alleg4)NAME
readkey - Returns the next character from the keyboard buffer. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
int readkey();
DESCRIPTION
Returns the next character from the keyboard buffer, in ASCII format. If the buffer is empty, it waits until a key is pressed. You can see
if there are queued keypresses with keypressed().
The low byte of the return value contains the ASCII code of the key, and the high byte the scancode. The scancode remains the same whatever
the state of the shift, ctrl and alt keys, while the ASCII code is affected by shift and ctrl in the normal way (shift changes case,
ctrl+letter gives the position of that letter in the alphabet, eg. ctrl+A = 1, ctrl+B = 2, etc). Pressing alt+key returns only the scan-
code, with a zero ASCII code in the low byte. For example:
int val;
...
val = readkey();
if ((val & 0xff) == 'd') /* by ASCII code */
allegro_message("You pressed 'd'
");
if ((val >> 8) == KEY_SPACE) /* by scancode */
allegro_message("You pressed Space
");
if ((val & 0xff) == 3) /* ctrl+letter */
allegro_message("You pressed Control+C
");
if (val == (KEY_X << 8)) /* alt+letter */
allegro_message("You pressed Alt+X
");
This function cannot return character values greater than 255. If you need to read Unicode input, use ureadkey() instead.
SEE ALSO install_keyboard(3alleg4), ureadkey(3alleg4), keypressed(3alleg4), clear_keybuf(3alleg4), simulate_keypress(3alleg4)Allegro version 4.4.2 readkey(3alleg4)
Check Out this Related Man Page
readkey(3alleg4) Allegro manual readkey(3alleg4)NAME
readkey - Returns the next character from the keyboard buffer. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
int readkey();
DESCRIPTION
Returns the next character from the keyboard buffer, in ASCII format. If the buffer is empty, it waits until a key is pressed. You can see
if there are queued keypresses with keypressed().
The low byte of the return value contains the ASCII code of the key, and the high byte the scancode. The scancode remains the same whatever
the state of the shift, ctrl and alt keys, while the ASCII code is affected by shift and ctrl in the normal way (shift changes case,
ctrl+letter gives the position of that letter in the alphabet, eg. ctrl+A = 1, ctrl+B = 2, etc). Pressing alt+key returns only the scan-
code, with a zero ASCII code in the low byte. For example:
int val;
...
val = readkey();
if ((val & 0xff) == 'd') /* by ASCII code */
allegro_message("You pressed 'd'
");
if ((val >> 8) == KEY_SPACE) /* by scancode */
allegro_message("You pressed Space
");
if ((val & 0xff) == 3) /* ctrl+letter */
allegro_message("You pressed Control+C
");
if (val == (KEY_X << 8)) /* alt+letter */
allegro_message("You pressed Alt+X
");
This function cannot return character values greater than 255. If you need to read Unicode input, use ureadkey() instead.
SEE ALSO install_keyboard(3alleg4), ureadkey(3alleg4), keypressed(3alleg4), clear_keybuf(3alleg4), simulate_keypress(3alleg4)Allegro version 4.4.2 readkey(3alleg4)
hi
i´m making a program, and i would like to know how can i know what key was pressed. i'm using Sun5.7 and C.
is there a keypress/keypressed function in C?
how can i know recognize the keys (enter, tab, shift, etc.)?
can i recognize two keys ? (shift+A, ctrl+C, etc)
any idea.. thanks (4 Replies)
I wrote a ksh script for Helpdesk. I need to know how to disable ctrl-c,ctrl-z,ctrl-d..... so that helpdesk would not be able to get to system prompt :confused: (6 Replies)
We develop a file in windows and move to unix box as a part of deployment. When we do this, we get ctrl-M(^M) character added to the file. So we need to remove ctrl-M(^M) character from all the files from deployment folder and all subfolders folder. Currently we move to individual folders and... (5 Replies)
hi,
I'm trying to create a program that will read a file and then check the file for each letter of the alphabet and then output the letter and the number of times it appears in the file, into a new file... this is what i have so far but it's not working.. if anyone could help that would be nice!... (10 Replies)
Hi ,
I faced a very strange problem when I unzip a zip file on my solaris workstation. Actually I wanted to transfer a folder, say it TEST which contains some sub-folders inside it from windows to solaris machine. So I zipped this folder to TEST.ZIP on my windows machine.
Then from my... (11 Replies)
Hi all,
My query is... in the runtime, you are getting any input string. Unfortunately, you have pressed some ctrl keys or esc keys or arrow keys while typing input string. You can get the input value like that...
input string as
welcome^
So ,I want to remove those unwanted keys... (4 Replies)
I'm sure it's really easy, but I have searched on Google and on the forums and haven't found anything.
For instance, if I open the grep manual (man grep), I can't close it.
I've tried ctrl+c, ctrl+x, scrolling to the bottom of the manual.
How can I exit the manual without closing the shell?
... (8 Replies)
Hello,
I am trying to free memory allocation after EOF from keyboard is detected (ctrl+D) in a C program. I've written a small program to replicate my problem:
int main(int argc, char *argv) {
char *line;
line = (char*)malloc(sizeof(char)*(512));
line = fgets(line, 512,... (10 Replies)
Hi all--
I'm using a SunOS machine at my campus and my pageup and pagedown keys are unresponsive inside of vi.
I'm not too thrilled about using ctrl+f and ctrl+b to do this operation, so I'm wondering how I might remap these keys to scroll up in down within the terminal as opposed to... (7 Replies)
if i have a server which wants to connect to exactly 5 clients, does that mean i need 5 socket file descriptors and use
listen(socket_fd,1);
for each one
or just do
listen(socket_fd,5)
also whats the second parameter number mean? what happens if i put 0 there?
also if i am connected... (28 Replies)
The problem is when i push button on keyboard and stay pressed i get only one letter. I want to set auto repeat of pressed character to get for example pressing a letter 'aaaaaaaaaaaaaa' instead 'a' only???
can you tell us how to enable this feature in linux???? (5 Replies)
Hi All,
I need to place a ctrl-c interrupt in a bash script, there is no other way, it has to be done :)
can someone please advise how would I go about this?
i want to use ctrl c in below code, after the code excution of just 1 min or 1sec
java Cspsamp 111.19.5.172 7025 rd1... (6 Replies)
I wanted to know if there was a more efficient to do this. I was to setup a conditional for every letter of the alphabet, like so (I am parsing an array):
for i in "${arr}"; do
if ]; then
echo "$i starts with A"
else echo "$i does not start with A"
fi
done
I want to do this A-Z, is there... (6 Replies)
Discussion started by: sudo
6 Replies
15. Post Here to Contact Site Administrators and Moderators
I know I've been away from the forums for past couple of months. But I am back now : )
I used to hit ctrl+B and ctrl+I after selecting the text to make text bold or italic respectively. (Pressing the keys would add and tags etc)
However, that is not working anymore. Did I miss something? (13 Replies)