finding number of characters in keyboard buffer? - Minix
This is a discussion on finding number of characters in keyboard buffer? - Minix ; comp.os.minix
finding number of characters in keyboard buffer?
What's a convenient way to find the number of characters in the keyboard
buffer?
Hul
--
- for email, put the word "keeper" in the subject line -...
-
finding number of characters in keyboard buffer?
comp.os.minix
finding number of characters in keyboard buffer?
What's a convenient way to find the number of characters in the keyboard
buffer?
Hul
--
- for email, put the word "keeper" in the subject line -
-
Re: finding number of characters in keyboard buffer?
htytus@shell1.iglou.com (Hul Tytus) writes:
> comp.os.minix
> finding number of characters in keyboard buffer?
>
> What's a convenient way to find the number of characters in the keyboard
> buffer?
I'm convinced there is none: Only the tty driver knows about those
(it's not a keyboard buffer, but quite probably a buffer in the tty
driver) and AFAIK he doesn't give the information to other processes
(no interface for that). You could implement a new ioctl in the tty
driver, though ...
Regards -- Markus
-
Re: finding number of characters in keyboard buffer?
Markus - I'd come to the same conclusion, although hoping to avoid writing more
code at the same time.
Hul
M E Leypold wrote:
> htytus@shell1.iglou.com (Hul Tytus) writes:
> > comp.os.minix
> > finding number of characters in keyboard buffer?
> >
> > What's a convenient way to find the number of characters in the keyboard
> > buffer?
> I'm convinced there is none: Only the tty driver knows about those
> (it's not a keyboard buffer, but quite probably a buffer in the tty
> driver) and AFAIK he doesn't give the information to other processes
> (no interface for that). You could implement a new ioctl in the tty
> driver, though ...
> Regards -- Markus
-
Re: finding number of characters in keyboard buffer?
Hul Tytus wrote:
> comp.os.minix
> finding number of characters in keyboard buffer?
>
> What's a convenient way to find the number of characters in the keyboard
> buffer?
>
> Hul
It would be best to just real all the data from the keyboard (or
standard input, whichever), and manage the data from a buffer from
within your program. This is the most portable (and thus best) approach
to this task.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFb2NJsjeOFtd+nycRAmQIAJ46RB/9irH73ZuEtImYAmJsT4cuUwCghfCu
bNY65K5PEIoa1tt82B2ky/U=
=4T9D
-----END PGP SIGNATURE-----
-
Re: finding number of characters in keyboard buffer?
How do you avoid getting lost in a getchar() type function when there is
nothing left in the keyboard buffer? Stated differently, what function
will report when the buffer is empty?
I tried using read("fd for /dev/tty", c, 1) but there was echoing and a
confusion visable on the screen that required rebooting. Possibly
setttyattributes(roughly) could be used for allowing read() access?
Hul
Segin wrote:
> [-- text/plain, encoding quoted-printable, charset: ISO-8859-1, 15 lines --]
> Hul Tytus wrote:
> > comp.os.minix
> > finding number of characters in keyboard buffer?
> >
> > What's a convenient way to find the number of characters in the keyboard
> > buffer?
> >
> > Hul
> It would be best to just real all the data from the keyboard (or
> standard input, whichever), and manage the data from a buffer from
> within your program. This is the most portable (and thus best) approach
> to this task.
> [-- application/pgp-signature, encoding 7bit, 9 lines, name: signature.asc --]
> [-- Description: OpenPGP digital signature --]