Stream stdout to file

This is a discussion on Stream stdout to file within the C Programming forums, part of the General Programming Boards category; Hi, I want my program to launch another program and read std out from it..this isn't a problem. However this ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    62

    Stream stdout to file

    Hi,

    I want my program to launch another program and read std out from it..this isn't a problem. However this other program never returns it just keeps on spewing out data. I'm wanting to capture this data and stream it to a file as it's received. Is this possible? I can't do this in a loop in my program because it needs to do other processing in parallel to this task.

    Any help much appreciated.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,833
    So are you just going to keep asking, or are you going to post an attempt using popen() or some mix of fork/exec/dup calls to allow two processes to communicate?

  3. #3
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Don't feel like writing a response, so you get year+ old threads. See my code example here. YMMV.
    Redirecting I/O
    hello, internet!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 05:14 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 01:13 AM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM

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