From: Steven Vacca <svacca@valcom.com>
To: "'Steven Vacca'" <svacca@valcom.com>,
"LinuxEmbeddedMailList (E-mail)"
<linuxppc-embedded@lists.linuxppc.org>
Subject: RE: Unbuffered char reads from App from stdin (keyboard)
Date: Mon, 18 Feb 2002 13:28:28 -0500 [thread overview]
Message-ID: <01C1B880.271F6C60.svacca@valcom.com> (raw)
FYI (For Y'all's Info):
Here's what I've done.
I wanted to check if 1 or more keys have been pressed, and if so,
get just the next available key in the buffer.
I then wanted to process that key before echoing it to the
terminal, if at all, for nth-degree of control.
- I used termios to disable console Cannonical mode and Echoes.
- I used fcntl() to make stdin Non_Blocking, since, if there's no
key in the buffer, read() will block.
- I then use:
read(0,&key,1);
to read just the next key, without blocking when there is no key
in the buffer.
ShutEyeThinkin
-----Original Message-----
From: Steven Vacca [SMTP:svacca@valcom.com]
Sent: Friday, February 15, 2002 10:10 AM
To: LinuxEmbeddedMailList (E-mail)
Subject: Unbuffered char reads from App from stdin (keyboard)
App and Linux kernel 2.2.13 running on mpc860T.
I would like to know the best way, from inside my GNU C App,
to sense if there's a keyboard key pressed. Something
similar to kbhit() in Microsoft C. I would like to have a particular
thread execute a loop continuously and only when a key
is present, do a getc() or getchar(), or gets(), and the like.
What is the best way to accomplish this?
Is there a way to make stdin unbuffered?
Thanks,
ShutEyeThinkin
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next reply other threads:[~2002-02-18 18:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-18 18:28 Steven Vacca [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-02-15 18:39 Unbuffered char reads from App from stdin (keyboard) Steven Vacca
2002-02-15 18:41 ` Rick Hunnicutt
2002-02-15 15:09 Steven Vacca
2002-02-15 15:31 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01C1B880.271F6C60.svacca@valcom.com \
--to=svacca@valcom.com \
--cc=linuxppc-embedded@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.