Re: Newbie C Questions
Re: Newbie C Questions
- Subject: Re: Newbie C Questions
- From: Ross Hayden <email@hidden>
- Date: Tue, 29 Jan 2002 23:28:29 -0500
Tom, I've been a Unix/C programmer for years, but am spankin' new to Cocoa,
so I can relate in a way to your situation.
I would say that, for the kind of study you're doing at this point in time,
you could work better from your Terminal command line instead of through
Project Builder. (This is coming from a Unix command-line guy as it is,
so I admit to some natural bias.)
In particular, the code you included in your Cocoa-Dev post, uses the
function calls printf() and scanf(). Those functions are designed to read
from a terminal interface, and not from a graphics interface such as that
provided in PB. That is why your code doesn't run in PB.
The overhead of writing a graphics-capable application may hinder your
presently developing C skills. A terminal interface is much simpler,
allowing you to focus your mental energy mostly on C and not Cocoa.
So perhaps the way you're working now is best. Use PB and the Standard
Tool option to enter the code for your program and to compile it, and then
hop out to a terminal window to run it. If you get tired of jumping back
into PB, you could always use vi to edit your program, and cc to compile
it, all from the terminal window.
I've found Apple's tutorial on Objective C to be good, once you're ready
to learn its syntax. You have it already on your hard drive as part of
the developer tools install. It's in
/Developer/Documentation/Cocoa/ObjectiveC/ObjC.pdf.
By the way, I too found "Learning Cocoa" to be quite obfuscatory. I like
"Cocoa Programming for Mac OS X" by Aaron Hillegass much better. It does
assume a good understand of C++ or Java though.
Good luck,
RR
On Tuesday, January 29, 2002, at 10:05 PM, Tom McKenna wrote:
Here are my questions (finally):
* When I am using Project Builder and I want to create a simple C
application, what kind of project should I be opening? (I have been using
the 'Standard Tool' option in PB...)
* Once I finish this book on C, I would like to learn Objective-C. Is
there a beginner's book that doesn't work under the assumption that you
know C++ or Java? If not, what should I do next?
* One of my tutorial apps compiles fine in PB, but it won't run in PB. It
does run perfectly in the Terminal. Am I doing something wrong? Here's
the code:
Sincerely,
Tom McKenna