I use the linux operating system. And at present programming in C.
The getch() doesn't seem to exist on Linux. I know that it is a DOS based command. What is the substitute for getch() on Linux.
I mean is there any command out there which can take my input without displaying the output. I tried the getpass() command but it doesn't work fine
Can someone please help.
mgb_phys
Aug26-08, 10:26 PM
getchar(), although if you need each character at a time without waiting for the enter key you might have to set the terminal mode.
Remember unix is written in C and C was invented for unix so any good C book (such as K&R) will apply directly to unix/linux
i.mehrzad
Aug27-08, 02:46 PM
Can you please repeat the name of the book. I mean i don't know the acronym
mgb_phys
Aug27-08, 03:03 PM
http://en.wikipedia.org/wiki/The_C_Programming_Language_(book)
It isn't the easiest intro to programming book, but if you have a background it is a good way to learn C.
jim mcnamara
Aug29-08, 10:53 PM
I don't have my example at hand. You have to use termios to set the terminal (tty) to non-canonical mode, read a keystroke, then reset the tty to canonical mode.
In other words it is OS dependent - the example I gave was unix-based. Windows has a call - _getche() as I remember. You can set the tty mode in windows as well.