Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kristiaand

macrumors member
Original poster
Dec 5, 2007
63
0
Hi all,
as mentioned i have some programming skill in another language on windows (borland delphi), and often when i was looking for answers on forums to problems, i would see hundreds of threads like this one, so here goes (man i feel like such a fool)

how do i launch another application from within my cocoa app?

specifically i would like to launch the terminal (hidden if possible) and pass it a command.

i am looking to call SMBClient and pass it a set of parameters to "automatically" mount a network share, i did have a sample app that launched programs but in my wild stupidity i have managed to loose it....

when i tried [open "smbclient <params>", 0] Xcode went crackers with errors...
 

yeroen

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
At the BSD-layer: fork() (or vfork() ) followed by one of the exec () family of functions (execl, execlp, execle, execv, execve, execvp, execvP)...

Although you can probably do this all in one shot at some Apple-provided Core/Cocoa layer..I don't know what's there off the top of my head.
 

Krevnik

macrumors 601
Sep 8, 2003
4,101
1,312
At the BSD-layer: fork() (or vfork() ) followed by one of the exec () family of functions (execl, execlp, execle, execv, execve, execvp, execvP)...

Although you can probably do this all in one shot at some Apple-provided Core/Cocoa layer..I don't know what's there off the top of my head.

NSTask? :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.