Operating System - HP-UX
1833874 Members
2087 Online
110063 Solutions
New Discussion

Re: Disabling command line buffering

 
senget76
Occasional Contributor

Disabling command line buffering

Usually, every command we enter does not return anything until we press enter,
However, I would like to have user to enter one character only as their selection by using getc in perlscript

somebody suggest me to use "stty cbreak". Unfortunately, this command is not avialable. I hope somebody can help me out.

Thank you
3 REPLIES 3
Stefan Farrelly
Honored Contributor

Re: Disabling command line buffering


This is well documented in the man page for termio (man 7 termio) under the section;

Non-Canonical Mode Input Processing (MIN/TIME Interaction)

Have it read. It explains how to setup so that a single key press can be processed in a script.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Robin Wakefield
Honored Contributor

Re: Disabling command line buffering

Hi,

The Term::ReadKey module should give you this in Perl.

#!/opt/perl5/bin/perl

use Term::ReadKey;

ReadMode 'cbreak';
$key=ReadKey(0);
ReadMode 'normal';

Rgds, Robin
Stefan Farrelly
Honored Contributor

Re: Disabling command line buffering

There a reply here on who to do it (bottom answer);

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x1be0fef4d250d611abdb0090277a778c,00.html
Im from Palmerston North, New Zealand, but somehow ended up in London...