Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a character from the console without pressing enter

Status
Not open for further replies.

Skute

Programmer
Jul 21, 2003
272
GB
Hi,

title kinda says it all really. In windows you can call getch() but there doesnt appear to be a similar function in linux?
 
well you can use getch() using the curses library.
Otherwise you will have to play around with the terminal for achieving this functionality.
 
how do i use the curses library?

do i need to include any header files?

i presume you cant do a #pragma comment (lib, "libname") in linux to link to a library?
 
cool thanks!

is the switch for g++ -lcurses ?
 
I hope that curses solve your purpose. Because it is basically a screen handling library. It was introduced in the original UNIX systems when there was no X-Windows. This was intrioduced to do some graphical programming in the text mode.
But Incase your purpose is not getting soved, then I doubt that you will have to go in for changing the properties of your terminal.
Hopefully you dont have to go to that extent.

Well the switch shall be -lcurses only. But you can try to be sure..

Happy cursing...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top