• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
What are argc and argv from Finder (was "Voodoo...")
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What are argc and argv from Finder (was "Voodoo...")


  • Subject: What are argc and argv from Finder (was "Voodoo...")
  • From: Jerry Krinock <email@hidden>
  • Date: Sun, 29 Feb 2004 12:20:09 -0800

The "voodoo" I reported yesterday is related to my having added some
command-line arguments to my application. It looks like the Finder is
sending some command-line arguments which are confusing my argument parser.

In the following well-known function...

int main(int argc, const char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
return NSApplicationMain(argc, argv);
}

someone is maing a point of passing argc and argv through to
NSApplicationMain. However, in document

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC
_classic/Classes/NSApplication.html

it says that NSApplicationMain(argc, argv) is "functionally similar to":

void NSApplicationMain(int argc, char *argv[]) {
[NSApplication sharedApplication];
[NSBundle loadNibNamed:@"myMain" owner:app];
[NSApp run];
}

which as as you can see it does not use argc or argv.

So, I'd like to know: What values of argc and argv does the Finder pass to
applications on the command line?

(Also, does anyone know a trick for writing things to console.app when an
application is launched from the Finder? You know, NSLog() to the
terminal.app won't work if I don't launch the app from terminal.app. If I
could write out argc and argv, I could quickly answer the question myself!)

Jerry
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: What are argc and argv from Finder (was "Voodoo...")
      • From: Bjoern Kriews <email@hidden>
References: 
 >Preference dialog (From: Steve Palmer <email@hidden>)

  • Prev by Date: Locating application bundle from a nib file
  • Next by Date: Re: Locating application bundle from a nib file
  • Previous by thread: Re: Preference dialog
  • Next by thread: Re: What are argc and argv from Finder (was "Voodoo...")
  • Index(es):
    • Date
    • Thread