Re: Q: FILE* popen command shell calls

From: James Lehman (james[remove)
Date: 12/12/04

  • Next message: Dr. Nikolaus Schaller: "Crashing dlopen() on Sharp Zaurus C860"
    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


  • Next message: Dr. Nikolaus Schaller: "Crashing dlopen() on Sharp Zaurus C860"

    Relevant Pages

    • How to check if a thread waits for data at the read-end of a pipe?
      ... Win32 and in the Win32 version I need a way to check ... attach a semaphore to a named pipe and I can then use the other API ... My application acts as a GUI command line shell in this regard. ... child's STDIN, STDOUT and STDERR streams in standard documented ways. ...
      (microsoft.public.win32.programmer.kernel)
    • Re: accomodating an unknown number of pipes in a shell program
      ... Each command is exec'd in a forked child process. ... Close all pipe file descriptors: ... the last pipe character) on to another child to repeat the process. ...
      (comp.unix.programmer)
    • Re: Some bash questions :-)
      ... The bash command below is meant to firstly list all files with the ... Try `grep --help' for more information. ... You probably don't want to "pipe" it per se. ... of the readlink command as an argument to cd, ...
      (comp.os.linux.misc)
    • Scripts using SSH and SSH_ASKPASS
      ... To test SSH scripts you better destroy the control TTY. ... The trick is to run YOUR script on YOUR local ... As for the password relaying command: this needs not be an X command. ... # we read one line from a temporary pipe. ...
      (comp.security.ssh)
    • Re: basic command pipe question
      ... =>to erase a bunch of files in one go. ... will execute a seperate process for *EACH* file to be deleted and would potentially overflow before the for loop even starts. ... Although, if I understand properly what's happening here, the pipe solution allows files to be erased as they are found in the filelist, while the gobbing method first requires that all files that match be found, then each command is executed one after another. ...
      (Fedora)