Re: [F-Script-talk] Dictionary and a shell command wanted :)
Brought to you by:
pmougin
From: Philippe M. <pm...@ac...> - 2006-08-24 09:09:50
|
Le 24 ao=FBt 06 =E0 10:44, Felix Franz a =E9crit : [...] > >> And how is possible to execute arbitrary shell commands (something >> like the exec() or system() C function)? > > The cocoa-way would be to use NSTask: > >> task :=3D NSTask launchedTaskWithLaunchPath:'/bin/ls' arguments: =20 >> NSArray array > > launches /bin/ls . > > See http://developer.apple.com/documentation/Cocoa/Reference/=20 > Foundation/ObjC_classic/index.html > for the glory details. > In addition, creating an Objective-C wrapper for a function like =20 system() and loading it in F-Script (see section 11 in the F-Script =20 guide) would be trivial (if you can program in Objective-C). =20 Something like this in Objective-C: -(int)executeInShell:(NSString *)str { return system([str UTF8String]); } Best, Philippe |