in reply to running status

The problem here is that backticks do not work properly under DOS. What you want to do is to issue the system() call like this:
system("c:\oggenc.exe c:test.wav");
This will output directly to the screen as your program runs.

As an aside, if you were under UNIX you could have done the following and it does work. It also works under Cygwin.

`program > /dev/tty`;

I would have thought that you could have done the same thing under Windows using CON, like this:

`c:\oggenc.exe c:test.wav > CON:`;
But it DOES NOT work. I believe this is a flaw in the way that the ActiveState Perl handles command execution.

metadoktor

"The doktor is in."

Replies are listed 'Best First'.
Re: Re: running status
by marauder (Novice) on Jan 12, 2002 at 23:27 UTC
    i think you missunderstand. i can use the system command and info is outputted to the screen ok but what i am trying to do is have the ability to look at avariable and see, for example when a file is 50% done then do something if it is like pop up a perl/tk message saying "50% done" or something. so you don't have to look at the dos box.
      Ok, I see your point. You want to read the output as it's happening?

      Unfortunately, it seems like the ActiveState version of Perl does not accept file redirection. You could download and install Cygwin along with it's distribution of perl. Then you would be able to run the following script which would probably do what you want.

      # Execute program and put it in the background. system("program > out.txt &"); # Wait for file to be created otherwise this will fail. sleep 3; open(IFILE,"<out.txt") or die "Couldn't open file. $!\n"; # Keep reading until nothing more to read. while (<IFILE>) { # Do something with output. print "$_\n"; } close(IFILE);

      metadoktor

      "The doktor is in."