in reply to Re: How to print STDOUT to a file
in thread How to print STDOUT to a file

Sorry but both solutions dont work, or I misunderstood you. Writing to a file would just result in printing the status of system(). Using system(prog, options, > file) results in a failure telling me that i dont use prog rigth an listing the options available. What did i wrong? I am working on Windows.

Replies are listed 'Best First'.
Re^3: How to print STDOUT to a file
by prasadbabu (Prior) on Nov 14, 2005 at 11:59 UTC

    Could you show us the exact system command you are using so that we can identify the mistake exactly.

    Prasad

      system($rnapath, "-p", "-noCloseGU", "-noLP", "$_") == 0 or die $?;
      $rnapath being the program called. Thank you for your patience.
        the bullet proof way:
        my $pid = fork; if (defined $pid and $pid == 0) { open STDOUT, ">", $fn or die; exec $script, @args; exit 1; } if ($pid) { waitpid($pid); $? and die "error on child: $?" } else { die "unable to fork: $!"; }