Accessing Terminal From Cocoa?

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

  1. macrumors 6502a

    Joined:
    Jan 19, 2004
    #1
    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.

    DC
     
  2. Administrator

    HexMonkey

    Staff Member

    Joined:
    Feb 5, 2004
    Location:
    New Zealand
    #2
    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. thread starter macrumors 6502a

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

    Thanks.
    DC
     

Share This Page