LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-20-2004, 05:35 AM   #1
Hugo Orlando
LQ Newbie
 
Registered: Nov 2003
Location: Argentina
Distribution: Fedora Core 2
Posts: 8

Rep: Reputation: 0
Question Reading from the keyboard


Hello,

I have the following segment of code:

while(1) {
read(0, &c, 1);
if (c >= 0x20) printf("key = %c\n", c);
fflush(0);
}

The problem is that the keys pressed don't appear until 'Enter' key is hit.
I would like reading from the keyboard immediately.
How do I fix it?

Thanks in advance
 
Old 12-20-2004, 05:53 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
look for the library fiunctions
tcgetattr and tcsetattr.



Have a look at the last post here.

http://www.linuxquestions.org/questi...ighlight=kbhit
 
1 members found this post helpful.
  


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
No keyboard on FC3 or Ubuntu--MS Multimedia Keyboard (PS/2) TravisOSF Linux - Hardware 4 03-04-2008 05:21 PM
Major problems with the keyboard! Microsoft keyboard is not compatable?. aweir14150 Mandriva 2 05-26-2006 06:57 AM
usb keyboard and soundcard conflict (sound set to keyboard?) netsurf Linux - Hardware 2 04-09-2005 07:08 AM
keyboard problems with xfce4 - general keyboard question Villain Linux - General 2 06-20-2004 04:35 PM
Assigning keyboard shortcuts to keyboard keys the who Linux - Hardware 3 02-20-2004 09:36 PM

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

All times are GMT -5. The time now is 04:43 PM.

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