Placement of pclose

This is a discussion on Placement of pclose within the Linux Programming forums, part of the Platform Specific Boards category; I'm wanting to open a stream with popen at the beginning of my app - do other things within the ...

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

    Placement of pclose

    I'm wanting to open a stream with popen at the beginning of my app - do other things within the app, then close the stream. My question is:

    Do I need to immediately pclose after popen or can I leave it open to keep collecting the stream while my app does other work?

  2. #2
    cwr
    cwr is offline
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    You can leave it open. You only use pclose once you are ready to get the exit status and let the process terminate.

    In future, you should probably direct questions about non-standard C function behaviour in an appropriate platform specific forum. In the case of popen/pclose, the Linux programming forum would be most appropriate.
    Last edited by cwr; 02-17-2006 at 12:00 AM.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    62
    Quote Originally Posted by cwr
    In future, you should probably direct questions about non-standard C function behaviour in an appropriate platform specific forum. In the case of popen/pclose, the Linux programming forum would be most appropriate.
    Thanks for your response. Sorry, I'm new to C and I don't know what functions are specific to what platform.

    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Placement new?
    By Elysia in forum C++ Programming
    Replies: 9
    Last Post: 02-26-2008, 04:50 AM
  2. pclose() vs fclose()?
    By cpjust in forum C++ Programming
    Replies: 14
    Last Post: 12-21-2007, 12:46 PM
  3. pclose without waiting for child
    By Largo in forum C Programming
    Replies: 1
    Last Post: 11-26-2005, 05:13 AM
  4. Placement..
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 03-01-2004, 10:21 PM
  5. CIOS college placement tests
    By compjinx in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 12-13-2002, 02:33 AM

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