Re: Q: FILE* popen command shell calls

Jens.Toerring_at_physik.fu-berlin.de
Date: 12/12/04

  • Next message: James Lehman: "Re: Q: FILE* popen command shell calls"
    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
    

  • Next message: James Lehman: "Re: Q: FILE* popen command shell calls"

    Relevant Pages

    • Re: pesky Pointers !!
      ... |> has to look like you pass to systemis dependent on the command shell ... |> interpreting that string. ... compiler does not support the former, ... As Karl pointed out, the 'system' function is standard, just not ...
      (alt.comp.lang.learn.c-cpp)
    • Re: pesky Pointers !!
      ... Well, systemsimply takes the string you pass to it, starts a command ... line shell and passes the string to that one. ... The systemcall by itself is standard. ...
      (alt.comp.lang.learn.c-cpp)
    • Re: Canon printer and TurboPrint
      ... it's even easier to set up that standard than it was to set up PCL standard. ... so one pipe - printer control, command and response method, most important command - get printer capabilities like resolutions supported, color supported or not as MUST BE in standard, all extras like configuring paper source, setting up printer specific options - optional. ... second pipe - just getting raw bitmap. ...
      (freebsd-questions)
    • Re: Considering white spaces in search patterns
      ... I am running a command like the one given below through a process: ... Are you passing a string ... If you are using the standard C function system, ... your shell might need you to quote it. ...
      (comp.lang.c)
    • Re: pesky Pointers !!
      ... > line shell and passes the string to that one. ... The command line shell ... The systemcall by itself is standard. ...
      (alt.comp.lang.learn.c-cpp)