Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

readkey(3alleg4) [opendarwin 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)

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)
Man Page

15 More Discussions You Might Find Interesting

1. AIX

Disable ctrl-c,ctrl-d,ctrl-d in ksh script

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)
Discussion started by: wtofu
6 Replies

2. Shell Programming and Scripting

Special Char in Multiple Files

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)
Discussion started by: thinakarmani
5 Replies

3. Programming

output the letters of the alphabet with the number of occurrences

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)
Discussion started by: svd
10 Replies

4. Solaris

strange problem regarding zip/unzip from window to solaris machine

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)
Discussion started by: Raj Kumar Arora
11 Replies

5. Shell Programming and Scripting

How to delete ctrl key values in a given string?

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)
Discussion started by: balan_mca
4 Replies

6. Shell Programming and Scripting

Exiting a manual

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)
Discussion started by: dennis89
8 Replies

7. Shell Programming and Scripting

How to issue ctrl+D and enter key

My problem is that i have to connect Linux server. I can connect it with SSH but because of the software of the Linux server, i need to press enter and after ctrl+D. Therefore, I need to write a script that should press enter and ctrl+D. How can i write it in KSH shell script. HELP ME! (7 Replies)
Discussion started by: fozay
7 Replies

8. Programming

Trouble freeing memory after ctrl+D

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)
Discussion started by: oddworld
10 Replies

9. UNIX for Dummies Questions & Answers

Page up in Terminal

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)
Discussion started by: Prodiga1
7 Replies

10. Programming

Help with sockets in C

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)
Discussion started by: omega666
28 Replies

11. Linux

Passing ctrl + c in shell scripting

Hi, How to pass ctrl + c in shell scripting. Regards, shausy (6 Replies)
Discussion started by: shausy
6 Replies

12. Linux

sticky keys enable in linux

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)
Discussion started by: mallikarjun7777
5 Replies

13. Shell Programming and Scripting

ctrl-c in bash script - Programming

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)
Discussion started by: aish11
6 Replies

14. Shell Programming and Scripting

Conditional for every letter in alphabet

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

Text formatting

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)
Discussion started by: clx
13 Replies