[Chicago-talk] Scalar help.

Brian Katzung briank at kappacs.com
Wed May 9 07:43:38 PDT 2007


Richard Reina wrote:
> Brian,
> 
> Thank you very much for your response.  Would you be able to direct me 
> to where I can get some examples of the syntax for this system call?  I 
> have not had any luck in experimenting with it.
> 
> Thanks,
> 
> Richard
> 
> */Brian Katzung <briank at kappacs.com>/* wrote:
> 
>     If this is for a *NIX-style system, you might want to consider TIOCSTI
>     (simulate typed input) in tty_ioctl(4).
> 
>     Richard Reina wrote:
>      > [...]
>      > Accordingly, if the user accidentally types the wrong first digit of
>      > the number (selection) the user cannot backspace and erase the first
>      > digit of the selection ($char) and retype it, but instead has to
>     start
>      > over. Is there a way to make $char accessible to the user so they
>     can
>      > backspace and erase it if they made a mistake?
>      >
>      > Thanks for considering my quandary.
>      >
>      > Richard

Richard,

Here's a sample program that simulates typed input, waits for the user 
to edit/enter a line, and prints what it gets.

#!/usr/bin/perl -w

use strict;

my $sti = "Hello, world";

sub TIOCSTI { 0x5412; }         # From e.g. /usr/include/asm/ioctls.h

foreach my $char (split(//, $sti))
{
         ioctl(STDIN, TIOCSTI, $char);
}
print "Input received: ", scalar(<>);

# END

-- 
Brian Katzung
Kappa Computer Solutions, LLC
www.kappacs.com 877.367.8837 x1



More information about the Chicago-talk mailing list