Re: Newbie Question about using selected file name with fopen
Re: Newbie Question about using selected file name with fopen
- Subject: Re: Newbie Question about using selected file name with fopen
- From: Ondra Cada <email@hidden>
- Date: Sun, 9 Apr 2006 23:02:00 +0200
Phil,
On 9.4.2006, at 22:33, Phil Faber wrote:
Does anyone know of a resource that would help make this decision
whilst I'm learning?
Sure -- the Cocoa reference. If it's there, use it. If it is not, try
posix or Carbon -- but not otherwise :)
i.e. something like a list of C commands and near-equivalent Cocoa
commands?
For starters and as a beginner, you can safely presume there's
*anything* in Cocoa :)
Later, you begin discovering that sadly it's far from truth, but far
as your needs are not too specific (and in the learning stage they
should not be, lest you bite more than you can conveniently swallow)
it is a very good presumption.
The trouble is that I'm discovering commands in C and using them,
only to discover later that there's a better version of that C
command in Cocoa!
Just forget there's stdlib/posix for the moment. Use plain C (not
libraries, but the language) and the Cocoa frameworks. Fall back to
posix (or Carbon) only in case you truly need some functionality and
for three days of busy sifting the documentation still cannot find a
Cocoa solution :)
Note: Cocoa brings a few niceties which sometimes replace even
language constructions, like NSArrays instead of plain C arrays, or
(not always, but often) NSDictionaries instead of plain C structs.
Or, much better than the newbie's
for (int i=0,n=[array count];i<n;i++) { // this is kinda clumsy
id o=[array objectAtIndex:i];
...
}
is something like this:
for (id o,en=[array objectEnumerator];o=[en nextObject];) { // this
is much better
...
}
(Myself, I've created a handy "forall" macro for that.)
Note also that, if there's a tedious job to be done often, Cocoa
tends to have a solution. Like, componentsSeparatedByString/
componentsJoinedByString, or makeObjectsPerformSelector, or using
NSUserDefaults to read command line arguments of a CLI tool, etc.
And when you are comfortable with basics--not before, lest you get
confused by different approaches!--search for "HOM" :)
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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