LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-09-2002, 09:10 AM   #1
LinuxQuest01
Member
 
Registered: Jun 2002
Distribution: RH 7.3
Posts: 30

Rep: Reputation: 15
Programming question


Hi,

I have a C question, hope you guys can help me. I would like to read a single character from input. Now one can do this using scanf or getchar. However, I would like to read it as soon as the user press the key. In other words, the user doesn't have to hit the <Enter> key in order for the character to be processes.

Does anyone know how to do this? I remember doing it before, but it's been a while...

Thanks in advanced.
 
Old 08-09-2002, 09:24 AM   #2
bbeers
Member
 
Registered: Jul 2002
Location: Florida
Distribution: Centos, Slackware
Posts: 260

Rep: Reputation: 30
Would fread() do the trick?

-bbeers
 
Old 08-09-2002, 11:28 AM   #3
LinuxQuest01
Member
 
Registered: Jun 2002
Distribution: RH 7.3
Posts: 30

Original Poster
Rep: Reputation: 15
No, I just try that function and it requires the <enter> key to be press... thanks though
 
Old 08-09-2002, 11:42 AM   #4
bbeers
Member
 
Registered: Jul 2002
Location: Florida
Distribution: Centos, Slackware
Posts: 260

Rep: Reputation: 30
Well, ... maybe you could poll() or select() and catch the input ?

-bbeers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
a little programming question haora Programming 3 06-24-2005 08:19 PM
Question about programming jcramer Mandriva 2 02-01-2004 02:22 PM
C Programming Question Makaveli.2003 Programming 4 03-03-2003 06:34 AM
Programming question pk21 Linux - Newbie 6 12-02-2002 01:17 PM
newbie programming question aizkorri Programming 4 03-22-2002 03:39 PM


All times are GMT -5. The time now is 08:58 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration