Calling a program within a program within a program with redirected io streams

This is a discussion on Calling a program within a program within a program with redirected io streams within the Linux Programming forums, part of the Platform Specific Boards category; This is another case of a fairly straightforward action, but it seems that the internet is only filled with documenting ...

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    Calling a program within a program within a program with redirected io streams

    This is another case of a fairly straightforward action, but it seems that the internet is only filled with documenting how to do slight variations of this.

    I want to call a program (which you'd normally use exec for) but redirect stdin and stdout to a fifo's that I've created in my program. I know how to do pipes on the command line, but how can you do this programmatically in C?

    I would've thought that the execve family of functions would allow you to specify FILE pointers in the function call for this, but I don't see that anywhere. The other method I can think of is assigning my FILE pointers to stdin and stdout, and then exec'ing. Does that work? It's a tad tricky to test in a small example...

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Oh nice... I spend all day sifting through google results, and as soon as I post, my second result in the next google search is this (posted for anybody with similar questions):

    http://www.gidforums.com/t-3369.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. calling constructor crashes program?
    By ichijoji in forum C++ Programming
    Replies: 6
    Last Post: 07-04-2003, 11:17 AM
  2. calling programs from a c++ program
    By md4u in forum C++ Programming
    Replies: 0
    Last Post: 05-04-2003, 07:39 AM
  3. calling a program from a program
    By Waldo2k2 in forum C Programming
    Replies: 2
    Last Post: 01-20-2003, 12:43 PM
  4. Calling an FTP from within a program
    By clancyPC in forum C Programming
    Replies: 2
    Last Post: 04-17-2002, 04:37 AM
  5. calling c++ program from a webpage
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 10-04-2001, 09:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21