in reply to Re: Redirect file write from external program to STDOUT
in thread Redirect file write from external program to STDOUT

I can specify the name of the output file. I get to select the name of printer if I choose to print. "Terminal device" for STDOUT is what I can't find with the program. I'm using Win32. Thanks.
  • Comment on Re: Re: Redirect file write from external program to STDOUT

Replies are listed 'Best First'.
Re: Re: Re: Redirect file write from external program to STDOUT
by BrowserUk (Patriarch) on Jun 26, 2003 at 14:38 UTC

    In that case, specify the name as "CON" (without the quotes of course. Let us know if it works:)


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


      Close enough. The program dumped stuff directly to DOS console (not via Perl's print). But the stuff looked like 'characters', not binary. Thanks still.

        Usiing CON as the filename will only get the output to the command line. To capture it into the program you should use open instead. Something like

        open IN, "echo $script | $program |" or die $!; binmode IN; my $img = do{ local $/; <IN> }; close IN;

        See perlopentut for the details of grabing program output using open. This is necessary as you will need to use binmode to prevent the stream being interupted by ^Z.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller