Re: how to make cocoa application run as a command line tool?
Re: how to make cocoa application run as a command line tool?
- Subject: Re: how to make cocoa application run as a command line tool?
- From: Jeremy Pereira <email@hidden>
- Date: Tue, 20 Oct 2009 12:27:02 +0100
On 20 Oct 2009, at 12:20, Jeremy Pereira wrote:
When I need to do this, I create a switch which puts the app into
"command line" mode.
static int commandLine(int argc, const char* argv[]);
int main(int argc, char *argv[])
{
if (argc > 1)
{
if (strcmp(argv[1], "-commandLine") == 0)
{
return commandLine(argc, argv);
}
}
else
{
return NSApplicationMain(argc, (const char **) argv);
}
}
Got that wrong. I think
if (argc > 1 && strcmp(argv[1], "-commandLine") == 0)
{
return commandLine(argc, argv);
}
else
{
return NSApplicationMain(argc, (const char **) argv);
}
might be better.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden