How do I redirect stdout from system/execlp calls?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Nilsson

    How do I redirect stdout from system/execlp calls?

    Hi,

    Does anyone know how to redirect text output when issuing a system or an
    execlp call? I have a GUI that insists on opening up a console whenever I
    give a system function call, and I would like to redirect the text output to
    a char buffer instead.

    Paul


  • tom_usenet

    #2
    Re: How do I redirect stdout from system/execlp calls?

    On Fri, 3 Oct 2003 18:38:53 +0200, "Paul Nilsson"
    <Paul.Nilsson@c ern.ch> wrote:
    [color=blue]
    >Hi,
    >
    >Does anyone know how to redirect text output when issuing a system or an
    >execlp call? I have a GUI that insists on opening up a console whenever I
    >give a system function call, and I would like to redirect the text output to
    >a char buffer instead.[/color]

    comp.unix.progr ammer might be a better place to ask, since standard
    C++ has no methods to interact with consoles or any way to launch
    processes other than "system".

    Tom

    Comment

    • WW

      #3
      Re: How do I redirect stdout from system/execlp calls?

      Paul Nilsson wrote:[color=blue]
      > Hi,
      >
      > Does anyone know how to redirect text output when issuing a system[/color]

      system("a command with output redirected");
      [color=blue]
      > or an execlp call?[/color]

      There is no execlp in standard C++: http://www.slack.net/~shiva/welcome.txt
      [color=blue]
      > I have a GUI that insists on opening up a console
      > whenever I give a system function call, and I would like to redirect
      > the text output to a char buffer instead.[/color]

      It will possibly still open a console. You will need to post your question
      to a newsgroup dedicated to your platform/compiler:



      --
      WW aka Attila


      Comment

      • Jerry Coffin

        #4
        Re: How do I redirect stdout from system/execlp calls?

        In article <blk8nu$bu$1@su nnews.cern.ch>, Paul.Nilsson@ce rn.ch says...[color=blue]
        > Hi,
        >
        > Does anyone know how to redirect text output when issuing a system or an
        > execlp call? I have a GUI that insists on opening up a console whenever I
        > give a system function call, and I would like to redirect the text output to
        > a char buffer instead.[/color]

        Find a newsgroup devoted to the OS you're using, and ask them about
        popen -- it's likely to be available, and if it's not, there are at
        least likely to be some people who will recognize the name and know what
        to advise as an alternative.

        --
        Later,
        Jerry.

        The universe is a figment of its own imagination.

        Comment

        • Paul Nilsson

          #5
          Re: How do I redirect stdout from system/execlp calls?

          "Jerry Coffin" <jcoffin@taeus. com> wrote in message
          news:MPG.19e957 a8a012dd33989b4 c@news.clspco.a delphia.net...[color=blue]
          > In article <blk8nu$bu$1@su nnews.cern.ch>, Paul.Nilsson@ce rn.ch says...[color=green]
          > > Hi,
          > >
          > > Does anyone know how to redirect text output when issuing a system or an
          > > execlp call? I have a GUI that insists on opening up a console whenever[/color][/color]
          I[color=blue][color=green]
          > > give a system function call, and I would like to redirect the text[/color][/color]
          output to[color=blue][color=green]
          > > a char buffer instead.[/color]
          >
          > Find a newsgroup devoted to the OS you're using, and ask them about
          > popen -- it's likely to be available, and if it's not, there are at
          > least likely to be some people who will recognize the name and know what
          > to advise as an alternative.[/color]

          Hi,

          Thanks, aparently this only works for console applications. However, the
          MSVC++7 documentation for the popen function links to a document showing how
          to do with a windows application as well! So you helped me anyway! Thanks,
          Paul
          [color=blue]
          >
          > --
          > Later,
          > Jerry.
          >
          > The universe is a figment of its own imagination.[/color]


          Comment

          Working...