RE: strange problem with STDIN- need help




Try adding this line to the top of your script:

$| = 1;

This sets STDOUT to autoflush the buffer. You may be trying to print
something that just isn't showing up.

-----Original Message-----
From: Poonam Pahil [mailto:poonam.pahil@xxxxxxxxx]
Sent: Thursday, December 29, 2005 2:23 AM
To: beginners@xxxxxxxx
Subject: strange problem with STDIN- need help

Hi,

Iam using <STDIN> to accept user input but the script just hangs at that
point.
I type in the value & program is just stuck at that point.

i know its got to do with buffer flushing. when iam using the same piece
of
code at the beginning of the script everything works fine.

iam using system() a lot. directing input/output to/from files. can this
be
the reason.

This is the piece of code:

print "Do you want to remove this CSpec(y/n):";
my $remove_CS = <STDIN>;
chop($remove_CS);
if($remove_CS =~ m/n/i )

Thanks & Regards
Poonam

.



Relevant Pages

  • Re: Creating script support for console application
    ... After mapping the file into memory, you may want to allocate a new buffer ... Of course, a decent script will keep track of line-numbers, so syntax errors ... > commands that tell the program where to BREAK, LOOP, START. ... > thinking of putting each line in an element of an array. ...
    (microsoft.public.vc.language)
  • pyodbc.Error Crash
    ... I believe this bug is also related to the other problem I just reported. ... DB = Microsoft Access XP ... # or buffer length ') ... The broke.py script has 4 select statements but only one is executed. ...
    (comp.lang.python)
  • Re: Numeric or character ?
    ... > anno4000@xxxxxxxxxxxxxxxxxxxxxxx (Anno Siegel) wrote: ... >> when the script happens to do mass IO via STDOUT. ... the buffer just doesn't fill up so much. ... "Reply" at the bottom of the article headers. ...
    (comp.lang.perl.misc)
  • Re: .Net Equivilant for sqlcmd or osql
    ... applications like SQL Management Studio work. ... Also, you do not have to strip the comments, it works just fine, ... Read EACH line into a string buffer. ... Read your script file and split it on the GO ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: A couple of SED questions
    ... with the shell script, not the sed script. ... There is a buffer - I think it is called the hold buffer - accessed with G, H, X and other commands. ... You may be using a version of sed which views end of line as the third s command delimiter. ...
    (comp.unix.shell)