Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

c language function looking like getch() on DOS

14 views
Skip to first unread message

Edouard Callens

unread,
Jan 27, 1999, 3:00:00 AM1/27/99
to
Does anybody know how to get a single char from terminal without
echo and before Newline char is entered?


On MS-DOS (oldies), there was a function getch() usually in conio.h
that did this purpose.


Please reply at edouard...@hotmail.com


Mark Adams

unread,
Jan 27, 1999, 3:00:00 AM1/27/99
to
In C there is a function called getc()
mark_adams.vcf

F. Michael Orr

unread,
Feb 2, 1999, 3:00:00 AM2/2/99
to edouard...@hotmail.com
Mark Adams wrote:

However, getc() does not allow the character at a time input the original
poster wanted; it does buffered I/O. I haven't thought too much about
this one, but I bet it would be ugly. I think the terminal would have to
be put into "raw" mode with a series of modifications via tcsetattr(),
and then you'd have to read() a single byte. It isn't as easy as the
getch() was, I'm afraid.

--
F. Michael Orr
Sr. Systems Engineer
Norfolk Public Schools, Norfolk, VA, USA
"Go Miami Dolphins!"

Ken Treimann

unread,
Feb 2, 1999, 3:00:00 AM2/2/99
to eduard_...@hotmail.com
Edouard Callens wrote:

> Does anybody know how to get a single char from terminal without
> echo and before Newline char is entered?
>
> On MS-DOS (oldies), there was a function getch() usually in conio.h
> that did this purpose.
>
> Please reply at edouard...@hotmail.com

Use the "curses" library (man curses). Don't ask me how to use it,
I just know that that's what you use.


--
Enjoy,
-Ken Treimann
treimann at us dot ibm dot com


0 new messages