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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to