Solved

Do you know how to use MPW?

Posted on 1998-11-18
1
208 Views
Last Modified: 2013-12-26
please refer to my previously asked question:

How the #*&?!! do I learn C?

as this is a continuation of that same theme.  actually, i’m trying to make myself a little clearer and hopefully get the info i really need.

my main problem is that i cannot try out programs on my mac.  i have mpw--and therefore a c and c++ compiler (mrc and mrcp).  i should be able to follow along with the online c tutorials, but i don't know how to use the compiler well enough and don't know how to run my programs.

i have been able to run one program now (yea, it’s hello world), but did not really understand what i was doing (the compiling part--the c lang. part was easy).  i had to create a makefile and then build a tool--i think.  actually i composed my c program in a new window, saved it as hello.c, chose “create build commands...” from the build menu selecting “tool” instead of “application” (tool was they key, why didn’t the “beginner’s” notes say anything about it?), and then chose “build” from the build menu.  after that i could type “hello” from the command line and “hello world” would spit out on the next line.

so, i need to learn to write and compile c programs within the MPW framework.  maybe the tool thing was the key and i’ll be able to progress on my own now.  but this morning i read over a tutorial that told me i should be using <stdin> instead of <stdio>.  was this a typo?  lots of the stuff i’ve read say that compilers have their own little perks and expectations of the programmer.  i need to know what those particulars are for MPW.  if you can give me even a small number of those key issues, i’d be very, very happy.

oh...please don’t give me any urls out of apple.com.  i’ve thoroughly checkout their programming links and have all their docs--they don’t help.  i guess apple never budgeted for good writers.
0
Comment
Question by:heathenchild
1 Comment
 
LVL 3

Accepted Solution

by:
boonstra earned 100 total points
ID: 1291597
The MPW documentation really isn't intended to teach you C.  For that, you ought to check out one of the many books on the subject.  One Macintosh-specific example is "Macintosh C Programming Primer, Vol I, by Dave Mark.  It isn't MPW-specific, but it will teach "C" on the Mac.  Another good online tutorial with demo apps is at:
<http://cafe.AmbrosiaSW.com/macintosh-c/>

MPW comes with a set of examples, though, and you can learn a lot from them.  Follow the path {MPW}:Examples:CExamples (where "{MPW}" is your MPW home directory.  Check out the file "Instructions" - it tells you how to go about building any one of the eight example programs.

The difference between a tool and an application is that a tool runs within MPW - you execute it by typing its name on the command line Unix-style.  An example of that is the "Count" program.

An application is a stand-alone program.  The SillyBalls example is one of these, as is the TESample (although that is too complicated to start with).  The reason the docs didn't point you to writing a tool is that most people, in fact, start with writing an application.

With respect to your stdio vs stdin question, they are different things.  stdio is a header file, and it includes the definitions to the routines associated with printing.  You want a line like
    #include <stdio.h"
in your program if you want to read from or print to files.  stdin is the standard input file, and is the thing you would actually read from.  So you would have code like
    fscanf(stdin,"%d",&inputVariable)
to read an integer into inputVariable.  (Of course, you would probably use the shorthand
    scanf("%d",&inputVariable)
to read from stdin, and save fscanf to read from a file on disk.

It doesn't sound to me like you have reached the point where any quirks of the MPW compilers are your problem.  Your issues seem to be the build process (MPW uses make files, analagous to what Unix does, instead of a GUI environment, like CodeWarrior).

Hope this helps some.  If you have more specific questions, I'll try to answer them.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 170
Turn a spreadsheet into a vba executable. 2 78
sum28 challenge 31 106
twoTwo  challenge 35 93
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now