Interacting with Shell

This is a discussion on Interacting with Shell within the C Programming forums, part of the General Programming Boards category; Hello, I want my program to execute a command [ ie, System(..) ], and read the resulting output into a ...

  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
    cwr
    cwr is offline
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    cwr
    cwr is offline
    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

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