Thread: Interacting with Shell

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    3

    Interacting with Shell

    Hello,


    I want my program to execute a command [ ie, System(..) ], and read the resulting output into a String.

    Im having a hard time finding information on how to do this (no doubt its out there, I just don't know what to look for).

    Can anyone share and example or point me in the right direction?


    Thanks

  2. #2
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    It's platform specific. The C language has no facility to do this directly. See http://www.eskimo.com/~scs/C-faq/q19.30.html.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Use popen() if your system has it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    Yes, that's what the FAQ said that I posted

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 34
    Last Post: 05-27-2009, 12:26 PM
  2. What shell is more powerful?
    By xddxogm3 in forum Tech Board
    Replies: 10
    Last Post: 07-24-2004, 10:47 PM
  3. System.ini Shell Problems
    By (TNT) in forum Windows Programming
    Replies: 2
    Last Post: 08-26-2001, 01:05 PM