Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C (http://www.programmingforums.org/forum60.html)
-   -   linux console input (http://www.programmingforums.org/showthread.php?t=13252)

rsnd May 31st, 2007 12:22 AM

linux console input
 
ok... So I got my telecom project working. Project involves writing a c program for chat program...etc etc etc... Problem is that I did it in windows and the lab where I'm supposed to demonstrate my project doesn't have windows. So I start porting it to linux and get rid of all the compiler errors and it doesn't give any syntactical or contextual error. Then when its time to link, it says it cant find _kbhit and _getch which corresponds to the lines:

:

... if (_kbhit()){
  c = _getch();
  ...


Well, turns out they don't exist in the world of linux.

I've declared some dummy functions with those names and tested, everything else works perfectly. Those 2 functions are the only things holding me back so I am serious need of linux equivalant of those functions. Could someone please help me out here.
Thanks heaps.

Game_Ender May 31st, 2007 2:48 AM

You are using for asynchronous keyboard IO right? You can use select on the stdin file descriptor to accomplish the same thing. You can use a timeout of 0 to check for characters waiting on stdiin.


All times are GMT -5. The time now is 2:30 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC