Re: Q: FILE* popen command shell calls
From: James Lehman (james[remove)
Date: 12/12/04
- Previous message: Jens.Toerring_at_physik.fu-berlin.de: "Re: Q: FILE* popen command shell calls"
- In reply to: Jens.Toerring_at_physik.fu-berlin.de: "Re: Q: FILE* popen command shell calls"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 12 Dec 2004 15:01:04 -0500
"2>&1"
Beautiful.
Thanks!
<Jens.Toerring@physik.fu-berlin.de> wrote in message
news:323pi6F3gtbmiU1@uni-berlin.de...
> James Lehman <james[remove]@akrobiz.com> wrote:
> > What's the short answer to get the output of dd,
> > good or bad, into a string?
>
> It depends. If you don't mind having standard output and standard
> error intermixed in the output then simple run you command with
> standard error redirected to stdout (i.e. with "2>&1" appended to
> the command). Otherwise you need, as the others already pointed
> out, to write your own version of popen(), creating a pipe, fork(),
> redirect the stderr of the command to the pipe (with dup() or
> dup2()) and then use one of the exec-functions to invoke the
> command. Then start reading on the pipe.
>
> Regards, Jens
> --
> \ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de
> \__________________________ http://www.toerring.de
- Previous message: Jens.Toerring_at_physik.fu-berlin.de: "Re: Q: FILE* popen command shell calls"
- In reply to: Jens.Toerring_at_physik.fu-berlin.de: "Re: Q: FILE* popen command shell calls"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|