Accessing Terminal From Cocoa?

Discussion in 'Mac Programming' started by DavidCar, Mar 28, 2005.

  1. DavidCar macrumors 6502a

    Jan 19, 2004
    I want to try monitoring some system statistics from a cocoa program. I don't know much about Terminal, but I'm wondering if I can issue a terminal command from cocoa and get back a string as a response. Then I can scan the string for what I want.

    If I knew where to start looking in the documentation I could go from there. Thanks.

  2. HexMonkey Administrator


    Staff Member

    Feb 5, 2004
    New Zealand
    Cocoa Dev Central has a couple of useful tutorials about this. The first is an example of writing a wrapper to the wget command. The second shows how to get the output of a command (in this case, the ls command).

    You might also like to look at the documentation for NSTask and NSPipe.
  3. DavidCar thread starter macrumors 6502a

    Jan 19, 2004
    Excellent! It would have taken me a while to find those references.


Share This Page