Title: Capturing the output of a sytem() command

You can do something like this.

 

$results = `$command 2>&1`;

 

This will redirect STDERR to STDOUT which is returned to $results.

 

Hope this helps.

 

-----Original Message-----
From: George Gallen [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 11:21 AM
To: [EMAIL PROTECTED]
Subject: RE: Capturing the output of a sytem() command

 

I wasn't thinking when I sent this one out.

 

I guess if I set it up as returning information into an array, vs a straigt

  $ varible, then I just read it like reading a file into an array.

 

Thanks

George

-----Original Message-----
From: George Gallen [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 10:56 AM
To: [EMAIL PROTECTED]
Subject: RE: Capturing the output of a sytem() command

Let me clarify ths slightly.

 

I'm using backticks to run the command, so I can capture the output.

But How do I read it sequentially, line by line.

 

I'm converting a file from ASCII -> BASE64, and want to read the

converted file directly from the base64 conversion routine.

 

I can use:  $output = `base64 -e ASCIIFILE -`

But how would I extract the line by line from $output?

 

George

-----Original Message-----
From: George Gallen [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 10:40 AM
To: [EMAIL PROTECTED]
Subject: Capturing the output of a sytem() command

Am I able to capture the output of a system call?

Currently, I route the output to a temporary file,
then read the contents in when the call is done.

I'd rather not make a temp file.

George

Reply via email to