bronxbomber92 Posted August 19, 2006 Share Posted August 19, 2006 How would you call the terminal and then input command into the terminal, using objective-c with cocoa? Like if you pressed a certain button in your program it will call the terminal and input the command for you. Thanks for any help! Link to comment Share on other sites More sharing options...
Korrupted Posted August 19, 2006 Share Posted August 19, 2006 I believe it's system(). Link to comment Share on other sites More sharing options...
bronxbomber92 Posted August 19, 2006 Author Share Posted August 19, 2006 so what, can you give me a small example accessing a folder? I'm rather new to objective-c... I'm acustom to c++ Link to comment Share on other sites More sharing options...
Korrupted Posted August 19, 2006 Share Posted August 19, 2006 Well you wouldn't see the Terminal window at all by calling system(), but here's a C++ example of how you can use it: #include <iostream> int main (int argc, char * const argv[]) { system("echo hi"); return 0; } To use it, you basically just pass a string that contains whatever you want Terminal to do. Link to comment Share on other sites More sharing options...
bronxbomber92 Posted August 19, 2006 Author Share Posted August 19, 2006 so basically, pesuedo code for going to the folder application would be this: if application_is_selected then system("cd /applications") end Sorry if that pesuedo code is a little off... Link to comment Share on other sites More sharing options...
Korrupted Posted August 19, 2006 Share Posted August 19, 2006 Sounds about right. Link to comment Share on other sites More sharing options...
bronxbomber92 Posted August 19, 2006 Author Share Posted August 19, 2006 Ahh! Thanks a lot. This will b very helpful, since I am looking into a compiler on mac that compiles programs for the Playstation Portable (more info on that at ps2dev.org). So the only difficult part would be the file browsing on selecting you code and everything. Acourse this would included a GUI So, now I need to learn that, and become a bit more familiar with objective-c and cocoa, and I'm on my way Link to comment Share on other sites More sharing options...
Recommended Posts