Copyright 2004 by M. Uli Kusterer Tue, 30 Nov -1901 08:00:00 GMT Comments on article book1 at Zathras.de http://www.zathras.de/angelweb/book1.htm book1 Comments witness_dot_of_dot_teachtext_at_gmx_dot_net (M. Uli Kusterer) witness_dot_of_dot_teachtext_at_gmx_dot_net (M. Uli Kusterer) en-us Comment 48 by Juanjo http://masters-of-the-void.com/book1.htm#comment48 http://masters-of-the-void.com/book1.htm#comment48 Yes, I have also just purchased XCode 4 and it looks quite different from the screenshots hown here, but still, if one looks carefully for the items named in teh tutorial, you can find them. I have tried this lesson and ... it worked!!! Certainly it is not great stuff for a first program, but it feels great when you run it, it works and you understand how it works. Thank you very much; I'll follow your course as I'm interested in writing educational programs for my kids using iphone, ipad or imac. Thank you very much indeed.
Comment 47 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment47 http://masters-of-the-void.com/book1.htm#comment47 Uli Kusterer writes:
Erjan,

yes, Xcode 4 has substantially changed. I hope to be updating this tutorial for Xcode 4, but it takes some time to re-take all the screen shots.
Comment 46 by Erjan Aisabay http://masters-of-the-void.com/book1.htm#comment46 http://masters-of-the-void.com/book1.htm#comment46 I just purchased XCode v.4.0.1 and it seems very different than what is described above. I am lost!!! Please advise, if you there is a similar explanations information specifically for 4.0.1. Thank you.
Comment 45 by TWhip http://masters-of-the-void.com/book1.htm#comment45 http://masters-of-the-void.com/book1.htm#comment45 Great walk-through! First time i have ever programmed with C or done anything with XCode and i understood the whole thing. Look forward to the rest of the tutorials
Comment 44 by Duelix http://masters-of-the-void.com/book1.htm#comment44 http://masters-of-the-void.com/book1.htm#comment44 This is the most amazing way for me to learn programming with a computer as my only tool. Thank you SO much.
Comment 43 by Chuck Huff http://masters-of-the-void.com/book1.htm#comment43 http://masters-of-the-void.com/book1.htm#comment43 Right out of the box I found it a little perplexing with the code that said:
return O; because it was suppose to be a 0. Once I got that figured out the rest of lesson one went smoothly. Haven't attempted the next part yet, but now I know what to look for, I Think.

Thanx

CAHuff
Comment 42 by Jonathan http://masters-of-the-void.com/book1.htm#comment42 http://masters-of-the-void.com/book1.htm#comment42 Jonathan writes:
I have a hard time knowing what, out of all of this awesome stuff, i REALLY need to memorize. I have a hard enough time retaining information unless i do something a few times. I can get all these programs to run, and generally understand why or what they are doing, but is it to my benefit to fiddle with them and try and change things to see if i really understand? or should i be patient... ! I only have a music degree dammit! ;-)

Also, i am interested (eventually) in game programming (as a hobby), like online flash games and such. Is this a good place to start, just learn a language? Will learning this on MAC, hold me back when i want to program on a pc?

Any tips are awesome! Thanks
Comment 41 by Kostis http://masters-of-the-void.com/book1.htm#comment41 http://masters-of-the-void.com/book1.htm#comment41 It says
[Session started at 2010-08-31 12:00:03 +0300.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1469) (Wed May 5 04:36:56 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys011
Loading program into debugger…
Program loaded.
run
[Switching to process 848]
Comment 40 by Kostis http://masters-of-the-void.com/book1.htm#comment40 http://masters-of-the-void.com/book1.htm#comment40 I have this one problem, 'Masters of the void' does not appear in the console window even though it says that the program succeeded. What might be my fault?
Comment 39 by dharmeshtx http://masters-of-the-void.com/book1.htm#comment39 http://masters-of-the-void.com/book1.htm#comment39 I have already finished my software engineering degree. I love C language. I believe it is mother of all programming languages. I feel much more comfortable then ever to learn with this tutorials. So far it is the best technique to learn "C language".
Comment 38 by Elaina http://masters-of-the-void.com/book1.htm#comment38 http://masters-of-the-void.com/book1.htm#comment38 [Session started at 2010-08-16 12:58:28 -0600.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
Loading program into debugger…
sharedlibrary apply-load-rules all
Program loaded.
run
[Switching to process 797]
Running…
We die, like fire and powder...
Debugger stopped.
Program exited with status value:0.

I see what you did there, putting a error in the example code. Thanks for helping me learn.
Comment 37 by stanley li http://masters-of-the-void.com/book1.htm#comment37 http://masters-of-the-void.com/book1.htm#comment37 i have the following error


The Debugger has exited with status 0.
[Session started at 2010-07-11 11:38:47 +1000.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1469) (Wed May 5 04:36:56 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
Loading program into debugger…
sharedlibrary apply-load-rules all
Program loaded.
run
[Switching to process 2572]
Running…
please enter your age :(gdb) run
[Switching to process 2574]
Running…
please enter your age :kill
quit
Comment 36 by Dan Kelleher http://masters-of-the-void.com/book1.htm#comment36 http://masters-of-the-void.com/book1.htm#comment36 If using Xcode 3.1.3 (the full installation) for PPC and OSX 10.5.8 then the template for a command line tool written in C is not found as Application --> Command Line Tool but rather as Command Line Utility
--> Standard Tool
Comment 35 by FKK http://masters-of-the-void.com/book1.htm#comment35 http://masters-of-the-void.com/book1.htm#comment35 very good tutorial!!!!! I've tried other tutorials, but your's is the best. You not only explains what to write, you explains the why too. And the visual graphics is very helpfull as well. And, it's very hard to find programming's tutorials using XCode for MAC users. Great for someone who is just beginning on programing, like myself. Very very thank you!!!!!
Comment 34 by chet http://masters-of-the-void.com/book1.htm#comment34 http://masters-of-the-void.com/book1.htm#comment34 very good!!!thank you so much for this tutorial!!!!
Comment 33 by Dave Stern http://masters-of-the-void.com/book1.htm#comment33 http://masters-of-the-void.com/book1.htm#comment33 Nice. Thanks so much, Uli. I'm not sure how much programming I'm going to do, if any, but this is a very clear-cut explanation of the concepts, so I can at least understand what's going on under the hood, as it were....
Comment 32 by Lauren http://masters-of-the-void.com/book1.htm#comment32 http://masters-of-the-void.com/book1.htm#comment32 Oh, I did type "Masters of the Void" initially. That was just me experimenting with the text.... I didn't know that's all it would do; I was expecting it to be much more complicated! Which just shows how great your tutorial is that I was confounded by how easy I sailed through this C stuff! Much thanks! :)
Comment 31 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment31 http://masters-of-the-void.com/book1.htm#comment31 Uli Kusterer writes:
Assuming that you wrote "programming is fun" instead of "Masters of the Void", then yes. :-)
Comment 30 by Lauren http://masters-of-the-void.com/book1.htm#comment30 http://masters-of-the-void.com/book1.htm#comment30 Thanks for responding, Uli! I chose the Console from the Run menu and did the Build and Run there. This is the text that popped up:


"[Session started at 2010-02-21 13:58:21 -0500.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
Loading program into debugger…
Program loaded.
run
[Switching to process 267]
Running…
Programming is fun.

Debugger stopped.
Program exited with status value:0."

Is this all that should've happened?
Comment 29 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment29 http://masters-of-the-void.com/book1.htm#comment29 Uli Kusterer writes:
Very likely you overlooked the part where it says "choose 'Console' from the 'Run' menu". That window is where any text will be shown. Was that it?
Comment 28 by Lauren http://masters-of-the-void.com/book1.htm#comment28 http://masters-of-the-void.com/book1.htm#comment28 So confused! I've followed this tutorial to the letter but when I Build and Run nothing happens...no error message, no text on the screen, no nothing. The build results say "Build Succeeded" with "no issues". Please help!
Comment 27 by Chris Patton http://masters-of-the-void.com/book1.htm#comment27 http://masters-of-the-void.com/book1.htm#comment27 Chris Patton writes:
Thanks for this tutorial it is very helpful and informative. I ran across this site because I started a blog detailing my journey towards becoming an iphone/mac developer at http://beginneriphonedeveloper.blogspot.com/. I figured that this site would be a helpful link to anybody who is like me and is new to learning about the programming for the mac and iphone.
Thanks a million!!!
Comment 26 by Garotas* http://masters-of-the-void.com/book1.htm#comment26 http://masters-of-the-void.com/book1.htm#comment26 In Xcode 3.1.4 (and maybe earlier) you have to go to the section "Command Line Utility" where you can find the "Standard Tool" which is in fact exactly the same thing like the "Command Line Tool" used for this tutorial. It has a different icon though. I'm just posting it because I couldn't find it right away. And because I think this tutorial is so great that I will be commenting every single page of it! ;)
Comment 25 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment25 http://masters-of-the-void.com/book1.htm#comment25 Uli Kusterer writes:
Charles,

"main" is a special name, whatever function you call "main" gets called by the operating system when your progrm runs.
Comment 24 by Charles Marshall http://masters-of-the-void.com/book1.htm#comment24 http://masters-of-the-void.com/book1.htm#comment24 Thanks Uli! That clears up a lot for me. Is "main" just a name for this particular function, shown in this example? Or would all programming, in other C examples for instance, also need a "main" function as well?
Comment 23 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment23 http://masters-of-the-void.com/book1.htm#comment23 Uli Kusterer writes:
Charles,

close. "printf" itself is located in "stdio.h", but you are *calling* it from inside another function, "main". Calling a function means telling the compiler to do whatever is inside a function. The "main" here is not a call, you are actually telling the compiler what commands to do when someone calls main. Usually, the operating system calls main, which is why you don't see any call to main here.

Also, the brackets { and } tell the compiler when "main" is finished. What "return 0" does is provide a return value, that is it tells the operating system *how* the program finished. If there is an error somewhere, you would return some error-number to give the system a clue what happened.

But yes, you're close.
Comment 22 by Charles Marshall http://masters-of-the-void.com/book1.htm#comment22 http://masters-of-the-void.com/book1.htm#comment22 So, let me see if I'm understanding this correctly: "stdio.h" is a program. "printf" is a command found within the "stdio.h" program. And the "printf" function is, in this example, located within another function, "main". And "return 0" is just a way to let the system know when "main" is finished.

Am I close?
Comment 21 by Alex Demitri http://masters-of-the-void.com/book1.htm#comment21 http://masters-of-the-void.com/book1.htm#comment21 I love your tutorial!
Keep it going, please!
Alex =)
Comment 20 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment20 http://masters-of-the-void.com/book1.htm#comment20 Uli Kusterer writes:
Rodolfo, if you're looking for reference documentation, I generally just use the"Open man page..." command in Xcode if I want to remind myself what a particular command does, otherwise I use Google to find out what call to use. For Mac specifics, there is also Apple's http://developer.apple.com web site, though that doesn't really cover much C, as it assumes you already know that part.
Comment 19 by Rodolfo Pena http://masters-of-the-void.com/book1.htm#comment19 http://masters-of-the-void.com/book1.htm#comment19 Hi, I really liked this tutorial since I'm trying to learn some C and I'm a mac user, so this is pretty much what I've been looking for. JUst one question, do you recomend any C or C++ manuals for a beginner, I mean, I use to program 18 years ago and the las time I wrote code was 15 years ago, and I use to write on all dead languages like cobol, clipper, dbase, and yeah GWBasic, so, I don't think that will be very useful for me now on the mac, but anyways, I can't remember very well either.
Some advice?

Thank You!!
Comment 18 by Bruno Gatjens http://masters-of-the-void.com/book1.htm#comment18 http://masters-of-the-void.com/book1.htm#comment18 Thank you so much for that tutorials.
Comment 17 by thinkdunson http://masters-of-the-void.com/book1.htm#comment17 http://masters-of-the-void.com/book1.htm#comment17 there's a free version of visual studio 2008 called express. you can download them (three versions, visual basic, visual C#, and visual C++) from www.microsoft.com/express

i would assume that the C++ version also works with C, but it's microsoft, so there's no telling.
Comment 16 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment16 http://masters-of-the-void.com/book1.htm#comment16 Uli Kusterer writes:
Harlan, I'm sure there are many equivalents for Windows to Xcode, but all the documentation and the descriptions on this site will be for Mac OS X, so you'll have a hard time following along. That said, there is of course Visual Studio on Windows, but AFAIK it has a rather hefty price tag. You could probably install the GCC compiler in a Windows version as well, but then you'll have to do all your compiling on the command line. However this will only let you create Windows programs, of course. You can't do iPhone or Mac applications that way, for that you'll still need a Mac at this point in time.
Comment 15 by Demian Velasco http://masters-of-the-void.com/book1.htm#comment15 http://masters-of-the-void.com/book1.htm#comment15 This is amazing, thanks a lot
Comment 14 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment14 http://masters-of-the-void.com/book1.htm#comment14 Uli Kusterer writes:
Emily, thanks, fixed.
Comment 13 by Emily http://masters-of-the-void.com/book1.htm#comment13 http://masters-of-the-void.com/book1.htm#comment13 The natural numbers do not include zero. A better definition would be both positive and negative whole numbers. Otherwise, this is very well written!
Comment 12 by Ryan Stonebraker http://masters-of-the-void.com/book1.htm#comment12 http://masters-of-the-void.com/book1.htm#comment12 Ryan Stonebraker writes:
AWESOME!!! it worked!!! now i know how to type on the screen!!! THANK YOU!!
Comment 11 by Harlan http://masters-of-the-void.com/book1.htm#comment11 http://masters-of-the-void.com/book1.htm#comment11 Carl Merritt writes:
How can I work through your tutorial using a Windows-based system? Is there an equivalent for Windows of the X-Code used in the Mac? Appreciate your help.


Sorry Carl M.
XCode is only for Mac. In order to create iPhone Apps you need ANY Intel based Mac.
A Mac Mini will do just fine to create Apps for iPhone or a Mac. Xcode will only work in Mac OS X Sorry man. If you watch Apples website in there Referb. section or Clearance you can pick up a Mac Mini for about $380. sometimes. Or you can get an iMac 20" 2.4Ghz around $800. maybe less just depends on the time. Just as long as its Intel you can create apps for iPhone
Comment 10 by Harlan http://masters-of-the-void.com/book1.htm#comment10 http://masters-of-the-void.com/book1.htm#comment10 I am reading the Tutorial in Safari with no problems. I wonder if its your screen your reading it on? I am on iMac 20" 2008 model. I have the Resolution @ 1680x1050.
Theres an option in Safari/Preferences/Advanced Very top UNIVERSAL ACCESS Check the box. And change the number to what ever size you like. You can tell the FONT to be no Smaller then 24 if you like.

You can also go in System Preferences/Speech and set up one of the voices and "Speak selected Text when the key is pressed."Set Key"
I use that when I dont feel like reading. The Mac just reads it to me!

But I can read it just fine. No Pink here.
Comment 9 by Carl Merritt http://masters-of-the-void.com/book1.htm#comment9 http://masters-of-the-void.com/book1.htm#comment9 How can I work through your tutorial using a Windows-based system? Is there an equivalent for Windows of the X-Code used in the Mac? Appreciate your help.
Comment 8 by Richard Henry http://masters-of-the-void.com/book1.htm#comment8 http://masters-of-the-void.com/book1.htm#comment8 Richard Henry writes:
Fantastic tutorial. I will definitely be coming back here very often!
Comment 7 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment7 http://masters-of-the-void.com/book1.htm#comment7 Uli Kusterer writes:
Daniel, the images are so small for several reasons: 1) because large images use bandwidth, and bandwidth costs me money 2) Because they're supposed to show you the windows and areas, and the text is there as an example, and not really intended to be read.
Comment 6 by Daniel Karlsson http://masters-of-the-void.com/book1.htm#comment6 http://masters-of-the-void.com/book1.htm#comment6 Daniel Karlsson writes:
It might be so that the "pink" text is the red texts in the xcode screens. I don't really understand why you have made them so small. Great work with the tutorial Uli.
Comment 5 by marius http://masters-of-the-void.com/book1.htm#comment5 http://masters-of-the-void.com/book1.htm#comment5 HI Uli,

hab gerade dein Tut überflogen und was mir besonders auffällt, das sich der weisse Text auf dem schwarzen Background shcwer anschauen lässt. Bei mir verschwimmen die Absätze bei nicht 100%igem Hinsehen zu weissen Blöcken. Die Comments z.B. auf grauem Hintergrund sind schon angenehmer aber irgendwie auch noch nicht das Optimum.

Vielleicht gehts nur mir so, ka. wollts nur mal anmerken.

Ansonsten ist es aber eine klasse Arbeit und ich finds cool, daß Du Sie den Leuten zur Verfügung stellst!

Gruß,
marius
Comment 4 by Stephen Johnson http://masters-of-the-void.com/book1.htm#comment4 http://masters-of-the-void.com/book1.htm#comment4 Stephen Johnson writes:
If you have trouble with white text on a black background, I suggest turning on the screen inversion shortcut in the Accessibility prefpane. Then you can just hit cmd+opt+shift+8 whenever you want to read this page.
Comment 3 by William Scott http://masters-of-the-void.com/book1.htm#comment3 http://masters-of-the-void.com/book1.htm#comment3 The white text on black background does give the illusion of being pale pink. There is something about the anti-aliasing of this in Safari that does make it hard to read. I just turned 45, and don't wear glasses, FWIW.

I use terminals and an editor (TextMate) with a black background and white font, but find it renders better when the anti-aliasing is turned off.
Comment 2 by Uli Kusterer http://masters-of-the-void.com/book1.htm#comment2 http://masters-of-the-void.com/book1.htm#comment2 Uli Kusterer writes:
Edward, there must be something wrong with your screen or browser. There is NO PINK AT ALL on any of my web sites, nor will there ever be. Nor is the background white. Do you perhaps have a custom style sheet set up? Or did you print this and one of your color printer cartridges are empty?

The colors here should be white-on-black text, with a pale prussian blue for the links. While I'm aware that white-on-black is not everyone's cup of tea, it just felt right for this site, and I took great care to maintain high contrast.

That said, there is a plan, eventually, to provide a downloadable/printable version, but that may take a while.
Comment 1 by Edward F. Storm http://masters-of-the-void.com/book1.htm#comment1 http://masters-of-the-void.com/book1.htm#comment1 I'd love to work through your tutorial, but I have a lot of trouble reading it. I'm a little up in years, and
the pale pink type on a white background is almost impossible. And it's a struggle to read the insets
which contain program text and Xcode stuff. Does your tutorial text exist in a pdf format or something
similar? Thanks for any help you can offer.