Before, I thought that you could interact with the command line only through Apple Script. I found a different way of doing it. If you have a script file for command line, you can access it and utilize it by using one of the following methods in Objective-C (Note, These are C functions)
- int result = system("Your Command Here");
- int result = system("Your Command Here > File.txt");
The result contains from my understanding a 1 if it completed without error or a 0 if it had an error, I could be wrong. All I know is if you handle the result like this.
- if (!result) {}
Now, if you have a script that can run in the background, you can use the following C command
- FILE *fileObject = popen("Your Command Here");
1 comment:
How can I print a FILE type object in Objective C?
Post a Comment