Re: Command Line Arguments
Re: Command Line Arguments
- Subject: Re: Command Line Arguments
- From: Ondra Cada <email@hidden>
- Date: Mon, 11 Apr 2005 16:30:15 +0200
Jason,
On 11.4.2005, at 16:09, Jason Whitehorn wrote:
I am a newbie when it comes to Cocoa programming, and am currently
trying to figure out how command line arguments are passed to my
program.
Actually you are not :))
I have a program that I am trying to associate with a specific file
type, and when I double click an associated file in Finder, I want my
program to launch and do something with the file.
This is done for you by the application framework.
Presumed your app is a document-based one, you don't do anything: the
file is automatically opened and you get it through the appopriate
NSDocument API (see NSDocument, or -- for starters -- just create an
NSDocument subclass in Xcode and see the method skeletons generated for
you).
Otherwise, you are informed through NSApplication delegate methods.
Check the NSApplication documenation.
I thought that I was suppose to use NSProcessInfo to accomplish this
goal, but all the "arguments" method accomplishes is getting me the
same "-psn_0_100401153" string that I was able to get from directly
accessing argv within main.
Incidentally, *if* you ever need to access the CLI arguments, do use
NSProcessInfo (or, in simpler cases, plain old NSUserDefaults), *not*
directly main.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden