LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-13-2009, 02:04 AM   #1
ananth86coolguy
LQ Newbie
 
Registered: Mar 2009
Posts: 28

Rep: Reputation: 15
Unhappy C program to perform an operation continuously until user presses a key


hi

em writing a program , where i need to call the ioctl() function continuosly until user presses a key.i tried all possibilities but could'nt figure out.

thanks in advance!!!
ananth
 
Old 03-13-2009, 04:42 AM   #2
bhaslinux
Member
 
Registered: Oct 2003
Location: UnitedKingdom
Distribution: Debian Bullseye
Posts: 357

Rep: Reputation: 49
use ncurses function wgetch/mvwgetch
this will return when you just press a key (no need to press enter)
 
Old 03-13-2009, 07:59 AM   #3
xc1024
Member
 
Registered: Dec 2008
Posts: 31

Rep: Reputation: 16
it is the long time since i wrote programs, so i may be not correct. you can try to make 2 threads - one for ioctl(), second for checking for keypress. if the key is pressed, keypress thread stops the ioctl() thread.
 
Old 03-13-2009, 09:29 AM   #4
ananth86coolguy
LQ Newbie
 
Registered: Mar 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Smile

hey thanks a lot for your suggestion.em using kernel threads !!!
 
Old 03-13-2009, 09:59 AM   #5
ananth86coolguy
LQ Newbie
 
Registered: Mar 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Smile

hey thanks man.i read abt the ncurses's mvgetch(y,x) macro yo mentioned. can you temme how should i use this function??em not clear abt this. .
 
  


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
wxwidgets / wxpython: grab global key presses eventhough frame is not in focus? browny_amiga Programming 3 04-10-2009 10:38 PM
Perform an operation on files x, y...direct output to x.out, y.out respectively johndoe0028 Linux - General 6 04-02-2006 10:39 PM
Simulating Key Presses Hal Programming 2 09-02-2005 05:05 PM
Detecting Arrow Key Presses in C / C++ BooKA. Programming 8 04-07-2004 06:10 AM
How to listen to all key presses in whole Linux? pvv Programming 1 03-28-2004 01:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:50 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