Re: Q: FILE* popen command shell calls
Jens.Toerring_at_physik.fu-berlin.de
Date: 12/12/04
- Previous message: Basile Starynkevitch [news]: "Re: Q: FILE* popen command shell calls"
- In reply to: James Lehman: "Re: Q: FILE* popen command shell calls"
- Next in thread: James Lehman: "Re: Q: FILE* popen command shell calls"
- Reply: James Lehman: "Re: Q: FILE* popen command shell calls"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 Dec 2004 20:55:34 GMT
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: Basile Starynkevitch [news]: "Re: Q: FILE* popen command shell calls"
- In reply to: James Lehman: "Re: Q: FILE* popen command shell calls"
- Next in thread: James Lehman: "Re: Q: FILE* popen command shell calls"
- Reply: James Lehman: "Re: Q: FILE* popen command shell calls"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|