running another program from a C++ program

Discussion in 'C++' started by Lorenzo Bettini, Sep 23, 2005.

  1. Hi

    I'd like to run a program from a running C++ program (i.e. spanning a
    new process) and would like to have access to its standard input and
    standard output and error (possibily via streams).

    I know about the popen posix function but that's not very flexible...
    is there a C++ way?

    thanks in advance
    Lorenzo
    Lorenzo Bettini, Sep 23, 2005
    #1
    1. Advertising

  2. Lorenzo Bettini wrote:
    > I'd like to run a program from a running C++ program (i.e. spanning a
    > new process) and would like to have access to its standard input and
    > standard output and error (possibily via streams).
    >
    > I know about the popen posix function but that's not very flexible...
    > is there a C++ way?


    No. All those things are platform-specific.

    V
    Victor Bazarov, Sep 23, 2005
    #2
    1. Advertising

  3. Lorenzo Bettini

    red floyd Guest

    Lorenzo Bettini wrote:
    > Hi
    >
    > I'd like to run a program from a running C++ program (i.e. spanning a
    > new process) and would like to have access to its standard input and
    > standard output and error (possibily via streams).
    >
    > I know about the popen posix function but that's not very flexible...
    > is there a C++ way?
    >
    > thanks in advance
    > Lorenzo


    Nope, it's system dependent. I'd recommend either comp.unix.programmer
    (based on your posix comment), or comp.windows.ms.programmer for win32.
    red floyd, Sep 23, 2005
    #3
  4. red floyd wrote:
    > Lorenzo Bettini wrote:
    >
    >> Hi
    >>
    >> I'd like to run a program from a running C++ program (i.e. spanning a
    >> new process) and would like to have access to its standard input and
    >> standard output and error (possibily via streams).
    >>
    >> I know about the popen posix function but that's not very flexible...
    >> is there a C++ way?
    >>
    >> thanks in advance
    >> Lorenzo

    >
    >
    > Nope, it's system dependent. I'd recommend either comp.unix.programmer
    > (based on your posix comment), or comp.windows.ms.programmer for win32.
    >


    Indeed I found
    http://doc.trolltech.com/3.3/qprocess.html
    since I'm using QT

    thanks anyway
    cheers
    Lorenzo
    Lorenzo Bettini, Sep 24, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pierre-Yves
    Replies:
    6
    Views:
    7,262
    Jim Gibson
    Mar 5, 2004
  2. Mandhare Prashant
    Replies:
    1
    Views:
    788
    Jack Klein
    Mar 14, 2005
  3. Replies:
    1
    Views:
    470
    Walter Roberson
    Aug 12, 2005
  4. Alexander Mahone

    Running a program (gperf) inside another C program

    Alexander Mahone, May 26, 2008, in forum: C Programming
    Replies:
    4
    Views:
    406
    Flash Gordon
    May 26, 2008
  5. Laurent Verweijen

    Running a program from another program.

    Laurent Verweijen, Jun 17, 2010, in forum: Python
    Replies:
    0
    Views:
    248
    Laurent Verweijen
    Jun 17, 2010
Loading...

Share This Page