getchar() used for keyboard i/p

Problem with getchar().

Using qcc and x86 platform.

c=getchar(); only returns when CR is hit and not when any other key is
pressed.
What am I doing wrong and how can I get round this?

Is there an eqivalent to a Kbhit() function ?

Ian

Is there an eqivalent to a Kbhit() function ?

A FAQ of programmers coming from DOS env.

Search in the major search engines by “kbhit UNIX curses” and
you’ll have bunch of suggestions.

kabe
Wow, isn’t search engines great…

In particular look at the readcond() function. The QNX6 extensions are
very useful for a lot of things like this.

Dave

kabe@sra-tohoku.co.jp wrote:

Is there an eqivalent to a Kbhit() function ?


A FAQ of programmers coming from DOS env.

Search in the major search engines by “kbhit UNIX curses” and
you’ll have bunch of suggestions.

kabe
Wow, isn’t search engines great…

Ian Gibb <iang@maconmgt.co.uk> wrote:
: Is there an eqivalent to a Kbhit() function ?

Take a look at the QNX 4 → QNX 6 Migration guide at:

http://qdn.qnx.com/support/docs/mig4nto/index.html

It mentions tcischars() as a replacement for kbhit().


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Your terminal needs to be in “raw” mode. See tcesetattr().

Marty Doane
Siemens Dematic

“Ian Gibb” <iang@maconmgt.co.uk> wrote in message
news:a3pl9m$caj$1@inn.qnx.com

Problem with getchar().

Using qcc and x86 platform.

c=getchar(); only returns when CR is hit and not when any other key is
pressed.
What am I doing wrong and how can I get round this?

Is there an eqivalent to a Kbhit() function ?

Ian

Oops, tcsetattr().

“Marty Doane” <marty.doane@rapistan.com> wrote in message
news:a3rpc2$st6$1@inn.qnx.com

Your terminal needs to be in “raw” mode. See tcesetattr().

Marty Doane
Siemens Dematic

“Ian Gibb” <> iang@maconmgt.co.uk> > wrote in message
news:a3pl9m$caj$> 1@inn.qnx.com> …
Problem with getchar().

Using qcc and x86 platform.

c=getchar(); only returns when CR is hit and not when any other key is
pressed.
What am I doing wrong and how can I get round this?

Is there an eqivalent to a Kbhit() function ?

Ian

\

Thanks, works fine now :slight_smile:

“Marty Doane” <marty.doane@rapistan.com> wrote in message
news:a3rpjn$sv5$1@inn.qnx.com

Oops, tcsetattr().

“Marty Doane” <> marty.doane@rapistan.com> > wrote in message
news:a3rpc2$st6$> 1@inn.qnx.com> …
Your terminal needs to be in “raw” mode. See tcesetattr().

Marty Doane
Siemens Dematic

“Ian Gibb” <> iang@maconmgt.co.uk> > wrote in message
news:a3pl9m$caj$> 1@inn.qnx.com> …
Problem with getchar().

Using qcc and x86 platform.

c=getchar(); only returns when CR is hit and not when any other key is
pressed.
What am I doing wrong and how can I get round this?

Is there an eqivalent to a Kbhit() function ?

Ian



\