Copyright 2004 by M. Uli Kusterer Tue, 30 Nov -1901 08:00:00 GMT Comments on article book2 at Zathras.de http://www.zathras.de/angelweb/book2.htm book2 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 66 by A Samuel W B http://masters-of-the-void.com/book2.htm#comment66 http://masters-of-the-void.com/book2.htm#comment66 Dear Uli,
Great Tutorial. Only point where i could not make head way is
int main()
{
int userName;

printf("Please enter your name:");

scanf("%s", &userName);
fpurge(stdin);

printf("nYour name is %s n", userName);

return 0;
}
Uli Kusterer replies: ★
You are using "%s" to tell scanf() to expect a string of text, but then you give it a variable that is declared as an int (which is an integer number). That can't work.

so instead of int what do you use?? KIndly let me know.
Comment 65 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment65 http://masters-of-the-void.com/book2.htm#comment65 Uli Kusterer writes:
That's a percent sign in that code, not an ampersand sign.
Comment 64 by John http://masters-of-the-void.com/book2.htm#comment64 http://masters-of-the-void.com/book2.htm#comment64 I get a "You are &d years old" ??
after simply copying your code
Comment 63 by Saad Saeed http://masters-of-the-void.com/book2.htm#comment63 http://masters-of-the-void.com/book2.htm#comment63 you really know how to make someone understand. Great Job!
Comment 62 by Udit Bhansali http://masters-of-the-void.com/book2.htm#comment62 http://masters-of-the-void.com/book2.htm#comment62 Why do I need to add the printf code again for the 2nd time after fpurge(stdin);?
Is it really necessary?

1 quick question
If we are creating a form then do we need to use the printf code again for the 2nd time?

The presentation shows that you use the printf code 2nd time to show the age. It'l like answering the question.
Comment 61 by rajesh http://masters-of-the-void.com/book2.htm#comment61 http://masters-of-the-void.com/book2.htm#comment61 #include <stdio.h>
int main()
{
int userInput;

printf( "Please enter your age: n" );

scanf( "%d", &userInput );
fpurge( stdin );

printf( "You are %d years old.n", userInput );

return 0;
}

ERROR:::
/tmp/ccqvb1xv.o: In function `main':
masters.c:(.text+0x3b): undefined reference to `fpurge'
collect2: ld returned 1 exit status
root@rajesh-desktop:/home/rajesh/raj# ./a.out
bash: ./a.out: No such file or directory

USING GCC::

what is wrong with is code ?
what exactly the fpurge will do ?
when we need to apply fpurge (is it compulsory to use)?
Comment 60 by Zakree http://masters-of-the-void.com/book2.htm#comment60 http://masters-of-the-void.com/book2.htm#comment60 Hi, great tutorial and helpful. I am new to C, Xcode and Mac. 'Thank you to the power of many GBytes' for spending your time creating this tutorial for free. I choose to learn C in order to master the objective C. I hope you will start to write on objective C too.. pleaseee.. :)
Comment 59 by Rolat http://masters-of-the-void.com/book2.htm#comment59 http://masters-of-the-void.com/book2.htm#comment59 Well, I'm getting the same error which Lindsay and Jaxerell mentioned. I understood that is not longer needed, but my though is that is not longer needed and has to be eliminated or the program cant be built. Is that right? If it is or even if it's not I would recommend to up-date the chapter with a comentary on this aspect. Thank you very much! Really good tutorial is helping me out :)
Comment 58 by aramirez http://masters-of-the-void.com/book2.htm#comment58 http://masters-of-the-void.com/book2.htm#comment58 aramirez writes:
Finally a easy to follow tutorial in which you actually learn the basics !!!
GREAT !

Thanks a lot.
Comment 57 by Gabriel http://masters-of-the-void.com/book2.htm#comment57 http://masters-of-the-void.com/book2.htm#comment57 I had a problem where it didn't want to build and run. I keep having errors. So I just took fpurge() off seeing that it was only there to remove unwanted characters and i managed to make it work. Why is this??
Comment 56 by Mike http://masters-of-the-void.com/book2.htm#comment56 http://masters-of-the-void.com/book2.htm#comment56 Hi Uli,

Great tutorial.

As Wulf Massell wrote, I too cannot see the movies. Intel iMac, OS 10.6.4, QuickTime Player 10.

Any suggestions?
Comment 55 by The Adamatrix http://masters-of-the-void.com/book2.htm#comment55 http://masters-of-the-void.com/book2.htm#comment55 The Adamatrix writes:
The short movies to iterate points of helpful lesson do not seem to be up and running as of this writing. Is this a recent thing? Many thanks,
Comment 54 by Josh http://masters-of-the-void.com/book2.htm#comment54 http://masters-of-the-void.com/book2.htm#comment54 this is the code i tried writing to show to my girlfriend

#include <stdio.h> // Defines printf etc.

int main()
{
char name;

//Write a string of text to the shell window:
printf( "Please enter your name: " );

scanf( "%s", &name );
fpurge( stdin );

printf( "You are %s and Josh loves you <3.n", name );
return 0; // Tell OS everything is OK.
}

and when i run it, it comes up with

Program loaded.
run
[Switching to process 2573]
Running…
Please enter your name: Chelsea
Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all

help please?
Comment 53 by Josh http://masters-of-the-void.com/book2.htm#comment53 http://masters-of-the-void.com/book2.htm#comment53 this is the code i tried writing to show to my girlfriend

#include <stdio.h> // Defines printf etc.

int main()
{
char name;

//Write a string of text to the shell window:
printf( "Please enter your name: " );

scanf( "%s", &name );
fpurge( stdin );

printf( "You are %s and Josh loves you <3.n", name );
return 0; // Tell OS everything is OK.
}

and when i run it, it comes up with

Program loaded.
run
[Switching to process 2573]
Running…
Please enter your name: Chelsea
Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all

help please?
Comment 52 by Timothy Basaldua http://masters-of-the-void.com/book2.htm#comment52 http://masters-of-the-void.com/book2.htm#comment52 Very helpful tutorial for the absolute beginner.
Thanks
Comment 51 by Kolo Rath http://masters-of-the-void.com/book2.htm#comment51 http://masters-of-the-void.com/book2.htm#comment51 Kolo Rath writes:
Hello Uli,

Dear Uli, i have written the first program on this page just as you have and it runs successfully without errors yet it does not appear on my terminal. Do you have any idea why? please answer
Comment 50 by Kolo Rath http://masters-of-the-void.com/book2.htm#comment50 http://masters-of-the-void.com/book2.htm#comment50 Kolo Rath writes:
Hello Uli,

Dear Uli, i have written the first program on this page just as you have and it runs successfully without errors yet it does not appear on my terminal. Do you have any idea why? please answer
Comment 49 by Kolo Rath http://masters-of-the-void.com/book2.htm#comment49 http://masters-of-the-void.com/book2.htm#comment49 This site is simply amazing! I think its really great that you took your time in creating a tutorial page directed for mac users, so once again thank you and keep up the great work.
Comment 48 by Kolo Rath http://masters-of-the-void.com/book2.htm#comment48 http://masters-of-the-void.com/book2.htm#comment48 This site is simply amazing! I think its really great that you took your time in creating a tutorial page directed for mac users, so once again thank you and keep up the great work.
Comment 47 by João http://masters-of-the-void.com/book2.htm#comment47 http://masters-of-the-void.com/book2.htm#comment47 I love your work guys. Please keep on going.
Comment 46 by João http://masters-of-the-void.com/book2.htm#comment46 http://masters-of-the-void.com/book2.htm#comment46 I love your work guys. Please keep on going.
Comment 45 by Sofia http://masters-of-the-void.com/book2.htm#comment45 http://masters-of-the-void.com/book2.htm#comment45 Just wanted to shout out a big thanks to you for creating this tutorial! I am a complete beginner - never done any programming at all... I want to learn! And this tutorial is great... explanatory, logical, well structured, and the comment section is great for further learning. Thanks!
Comment 44 by SC http://masters-of-the-void.com/book2.htm#comment44 http://masters-of-the-void.com/book2.htm#comment44 @MO

Hurr duur.

<code>

#include <stdio.h>
#include <stdlib.h>
int main(){
char *userName = malloc(sizeof(char)*25);
printf("Please enter your name:");
if (scanf("%s", userName))
printf("nYour name is %s n", userName);
return 0;
}

</code>
Comment 43 by Jaime http://masters-of-the-void.com/book2.htm#comment43 http://masters-of-the-void.com/book2.htm#comment43 Hi Uli,
I did all that was in the text but when I execute the program I have to put the answer (age) twice before it works. It works fine but just want to be able to answer once before it works.
Thanks
Comment 42 by Rafael Estrella http://masters-of-the-void.com/book2.htm#comment42 http://masters-of-the-void.com/book2.htm#comment42 Nevermind. I went back and read a similar comment. Thanks.
Comment 41 by Rafael Estrella http://masters-of-the-void.com/book2.htm#comment41 http://masters-of-the-void.com/book2.htm#comment41 Every time I try to run I try to run this code I get this window called "MyFirstProgram.xcodeproj". It says "Stop Executable" then within a field says MyFirstProgram, Project:"MyFirstProgram.xcodeproj" Target:"MyFirstProgram". Is this caused by a setting on my app? At first I typed in the code myself, then I copied and pasted your code; same error.

What can I do?
Comment 40 by Mike http://masters-of-the-void.com/book2.htm#comment40 http://masters-of-the-void.com/book2.htm#comment40 Not sure if this site is still active - I'm writing this on 20 September 2010 - but I thought I'd add an update to the fpurge() issue discussed above. Using Snow Leopard (10.6.4), I tried to run the program without any of the fpurge( stdin ) lines. The program ran once, after which it asked again, "What operation do you want to do?" - but then immediately wrote "Finished." before I could respond. When I added fpurge( stdin ) after the three scanf() lines, the program ran as it should have, and waited for me to respond to the question. So it seems that fpurge( stdin ) is still needed in Snow Leopard.

PS: The Xcode version I'm using is xcode_3.2.3_and_ios_sdk_4.0.2

PPS: This looks like a really useful site - more useful than the C programming book I shelled out for a few weeks ago!
Comment 39 by Jayden S. http://masters-of-the-void.com/book2.htm#comment39 http://masters-of-the-void.com/book2.htm#comment39 #include <stdio.h>

int main()
{
int userName;

printf("Please enter your name:");

scanf("%s", &userName);
fpurge(stdin);

printf("nYour name is %s n", userName);

return 0;
}
Uli Kusterer replies: &#9733;
You are using "%s" to tell scanf() to expect a string of text, but then you give it a variable that is declared as an int (which is an integer number). That can't work.

so instead of int what do you use??
Comment 38 by Rapha http://masters-of-the-void.com/book2.htm#comment38 http://masters-of-the-void.com/book2.htm#comment38 Hi Uli,
I'm designer rather than programmer, no previous programming knowledge/skills. It's usually a pain for me to learn those things the "dry" way.

I did all the exercise to that point here, works fine. Great!

But than I tried something similar like Mo. You answered "You are using "%s" to tell scanf() to expect a string of text, but then you give it a variable that is declared as an int (which is an integer number). That can't work."
Makes perfect sense. Can you tell us what exactly to do to make that work? that would be helpful.

Thanks!
Comment 37 by Danilo http://masters-of-the-void.com/book2.htm#comment37 http://masters-of-the-void.com/book2.htm#comment37 If we tell to compiler than a, b, anc c are "Integer" (int a, b, c;) why later we must put "%d" or anything else?
Comment 36 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment36 http://masters-of-the-void.com/book2.htm#comment36 Uli Kusterer writes:
Eliot, numbers on the computer have a certain range. So if you go higher or lower than a certain number, you will get wrong results. For example, on your typical Mac, an "int" can hold numbers from a bit under -2 billion to a bit over 2 billion. (The numbers are very odd, because a computer internally uses bits to store a number in binary (base 2), and doesn't store them as base-10 like we humans do on paper, so there's no straight one-to-one mapping in number of digits.
Comment 35 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment35 http://masters-of-the-void.com/book2.htm#comment35 Uli Kusterer writes:
Saif, that should be fixed now.
Comment 34 by Eliot Slevin http://masters-of-the-void.com/book2.htm#comment34 http://masters-of-the-void.com/book2.htm#comment34 Im intrigued why of you enter a ridiculously value ten digits or over you get back such a weird age
Comment 33 by RedPill http://masters-of-the-void.com/book2.htm#comment33 http://masters-of-the-void.com/book2.htm#comment33 make sure to include stdio.h people!
Comment 32 by Saif Sajid http://masters-of-the-void.com/book2.htm#comment32 http://masters-of-the-void.com/book2.htm#comment32 This specific page of the tutorial doesn't show up properly. The page expands beyond the screen resolution. Here is a pic of the problem http://i45.tinypic.com/24zkxds.jpg See the scroll bars? I have to scroll around to see the whole thing. hope you fix it. Using a Macbook with 1200x800 resolution
Comment 31 by Wulf Massell http://masters-of-the-void.com/book2.htm#comment31 http://masters-of-the-void.com/book2.htm#comment31 I like your tutorials and would really enjoy seeing the movies. I run 10.6.3 on an Intel Mac and am unable to engage your animations. I have QuickTime Player 7.6.6 Pro, as well as QuickTime Player 10.0. I read that you created these using Keynote. That really interests me and I will distract myself towards creating animations to when I have completed all your tutorials. Thanks - Wulf
Comment 30 by James Ferner http://masters-of-the-void.com/book2.htm#comment30 http://masters-of-the-void.com/book2.htm#comment30 I just want to say how great this site is. I am a complete beginner to programming but just after two sessions I feel encouraged that I can learn. Thank you.
Comment 29 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment29 http://masters-of-the-void.com/book2.htm#comment29 Uli Kusterer writes:
BTW, see the chapter on error messages for more help on this and other errors: http://www.masters-of-the-void.com/book10.htm
Comment 28 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment28 http://masters-of-the-void.com/book2.htm#comment28 Uli Kusterer writes:
The error "Warning: Incompatible implicit declaration of built-in-function 'printf'" means you haven't included the <stdio.h> header, which is where printf() is declared. If you do not declare a function (or include a file that declares it), C just assumes it has certain parameters and return values.

This was useful in the old days, when C did not have declarations. However, declarations have the advantage that the C compiler can notice mistakes (e.g. if you pass parameters in the wrong order) and warn you when it compiles the file, instead of just crashing when you run your program.
Comment 27 by Max http://masters-of-the-void.com/book2.htm#comment27 http://masters-of-the-void.com/book2.htm#comment27 Same implicit issue...any ideas
Comment 26 by RowdyRocket http://masters-of-the-void.com/book2.htm#comment26 http://masters-of-the-void.com/book2.htm#comment26 As Christian mentioned above you have to use the return key, the enter key on your numeric keypad will cause it to do nothing.
Comment 25 by Raul http://masters-of-the-void.com/book2.htm#comment25 http://masters-of-the-void.com/book2.htm#comment25 Hello, hey I can't use the printf command in the line printf( "I am %d years...

It says: Warning: Incompatible implicit declaration of built-in-function 'printf'
Comment 24 by Garotas* http://masters-of-the-void.com/book2.htm#comment24 http://masters-of-the-void.com/book2.htm#comment24 Uli, couldn't you add some sound to the movies? I think they are amazing! they look pretty slick and make things really clear. I am surprised that you did them in Keynote!
Please, put some clicking sound on it, or let a computer voice read some text... (or the moose!). I thing that would be cool.
Comment 23 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment23 http://masters-of-the-void.com/book2.htm#comment23 Uli Kusterer writes:
Rob, that's all Keynote. See my blog posting at http://zathras.de/blog-abusing-keynote-for-animations.htm
Comment 22 by Rob http://masters-of-the-void.com/book2.htm#comment22 http://masters-of-the-void.com/book2.htm#comment22 Great stuff thanks very much....what did you do the graphic part of your quick time clip with?
Comment 21 by Charles Marshall http://masters-of-the-void.com/book2.htm#comment21 http://masters-of-the-void.com/book2.htm#comment21 This is a great tutorial and a great format for learning. The Comments section not only helps to answer my questions but I'm learning a lot by trying to answer other's before I read your reply! I've always thought learning what causes something to fail helps to reinforce the understanding of how it works. Great Job! Keep up the good work!
Comment 20 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment20 http://masters-of-the-void.com/book2.htm#comment20 Uli Kusterer writes:
Sam,

the format string is one long string as the first parameter, not three short ones as the first three parameters, so this should be:

printf( "a = %d, b = %d, c = %d", a, b, c );

If you add extra quotes, that means the commas are seen as parameter separators, not as punctuation used inside the text.
Comment 19 by sam http://masters-of-the-void.com/book2.htm#comment19 http://masters-of-the-void.com/book2.htm#comment19 Hey there,

Great tutorial but one slight issue, when I have these lines of code in xcode, I get the following warning:
a = b = c = 23;
printf("a = %d", "b = %d", "c = %d",a,b,c);

warning: format '%d' expects type 'int', but argument 2 has type 'char *'

When I run these lines I get this output: a = 3919
Comment 18 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment18 http://masters-of-the-void.com/book2.htm#comment18 Uli Kusterer writes:
MO, one more note: If you want to get text from the user, proceed with this tutorial. We will eventually get around to explaining how to declare a variable that can hold text, and will write a program that lets you type in text.
Comment 17 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment17 http://masters-of-the-void.com/book2.htm#comment17 Uli Kusterer writes:
kevin, Can you post your code here? My guess is something is wrong with your scanf() line.
Comment 16 by kevin http://masters-of-the-void.com/book2.htm#comment16 http://masters-of-the-void.com/book2.htm#comment16 i wrote my program the exact way it is shown here and in the console when i run the program the line saying enter your age appears and i enter a number then press return but nothing happens. only when i type q to quit then press return does the line you are blank years old appear. help?

Comment 15 by jagdish kapkoti http://masters-of-the-void.com/book2.htm#comment15 http://masters-of-the-void.com/book2.htm#comment15 superb article,u r the only website which provides such text which is mac specific
Comment 14 by Christian http://masters-of-the-void.com/book2.htm#comment14 http://masters-of-the-void.com/book2.htm#comment14 Thank you Uli,

I figured it out. I was also pressing enter on the number pad rather than return on the main keyboard to move the program along.

Thanks for the quick reply.
Comment 13 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment13 http://masters-of-the-void.com/book2.htm#comment13 Uli Kusterer writes:
Jaxerell, fpurge() is not always needed. The issue is that on some versions of Mac OS and Linux you would need to use this command, while newer versions of Mac OS for example don't need it anymore. But according to the ANSI standard, you have to use fpurge() in this context, so I thought I'd be better safe than sorry.
Comment 12 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment12 http://masters-of-the-void.com/book2.htm#comment12 Uli Kusterer writes:
Andrew, where the application goes depends on various factors (settings specified in the project and in Xcode's preferences). In a bog-standard Xcode setup, you should see the executable in a "build" folder next to your project file. Usually it is in a "Debug" or "Release" folder in there. Alternately, you can double-click the icon for the generated application in the little brown "Products" folder in the Groups & Files list of your project window to launch it with Terminal.
Comment 11 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment11 http://masters-of-the-void.com/book2.htm#comment11 Uli Kusterer writes:
Christian, you probably didn't open the "Console" window: Choose "Console" from the "Run" menu and you will have a window with your text. Your program was happily running, you just didn't see it. Hence the error message about having to stop the running program before you can start it again.
Comment 10 by Christian http://masters-of-the-void.com/book2.htm#comment10 http://masters-of-the-void.com/book2.htm#comment10 Hello, I am not able to get the second part to run.

scanf( "%d" , &userInput );
fpurge( stdin );

printf( "You are %d years old.\n", userInput );
return 0;

Once I input my age and hit return nothing happens.
Also when I hit build and go a screen pops open and says stop executable... i click ok to continue building and then it runs but I am not sure why it pops open with that warning. It did not do it for the previous programs.

Xcod v3.13

Thanks

Christian
Comment 9 by Andrew Hobson http://masters-of-the-void.com/book2.htm#comment9 http://masters-of-the-void.com/book2.htm#comment9 Once I compile the project, if I want to quit Xcode and run the program from the "real" MacOS X Terminal, what mst I do?
Where is the final program stored?
How can I execute it?
Comment 8 by Jaxerell http://masters-of-the-void.com/book2.htm#comment8 http://masters-of-the-void.com/book2.htm#comment8 I had the same problem/error as Lindsay, with stdin, so I just took the line out, the whole fpurge line.

It worked with a plain number, and when I entered a number AND text, it ignored the text and just used the number. This is what you said that fpurge does, yet it did it without the line.
Comment 7 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment7 http://masters-of-the-void.com/book2.htm#comment7 Uli Kusterer writes:
zach, that Terminal display is where you enter stuff in Xcode to get it into your running program.

To actually write a graphical user interface, you need to do some additional work (usually involving the use of the Objective C programming language and Cocoa framework). It's just that this would exceed the scope of this tutorial, so I stuck with the Terminal-esque text input/output calls to keep things simple.

But that Terminal-like window Xcode opens should be enough for most uses until you're familiar with C and want to move on to Objective C.
Comment 6 by zach http://masters-of-the-void.com/book2.htm#comment6 http://masters-of-the-void.com/book2.htm#comment6 Let's say I code something where the user can input three numbers, and the c code can calculate them together. Does XCode run this code and open up a little space where the user can input the numbers? I ask this because each time I run my simple c code, it opens a Terminal-esque display. Do I have to run a different compiler if I am writing software c code where the user will need to input data and interact with my software?

Sorry, brand new to c, willing to learn. Just downloaded Xcode, but not sure past the point of the Console running my code in a Terminal like display format.
Comment 5 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment5 http://masters-of-the-void.com/book2.htm#comment5 Uli Kusterer writes:
You are using "%s" to tell scanf() to expect a string of text, but then you give it a variable that is declared as an int (which is an integer number). That can't work.
Comment 4 by MO http://masters-of-the-void.com/book2.htm#comment4 http://masters-of-the-void.com/book2.htm#comment4 I want to write a program to for his/her name, and this what I did:

#include <stdio.h>

int main()
{
int userName;

printf("Please enter your name:");

scanf("%s", &userName);
fpurge(stdin);

printf("\nYour name is %s \n", userName);

return 0;
}

but when I run it, this what happen:

Please enter your name:mohammed

[Session started at 2009-05-14 15:52:09 -0600.]
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
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 "i386-apple-darwin".Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/grey_falkon2003/Documents/first project revised/build/Debug/first project revised', process 894.
kill

The Debugger Debugger is attaching to process

*** I don't know whats wrong!!
Comment 3 by Gaby J http://masters-of-the-void.com/book2.htm#comment3 http://masters-of-the-void.com/book2.htm#comment3 Hey, I'm starting a project (developing an iPhone app), and I need to learn C first. You guys are one of the only sites that teaches this in "Mac terms", and it's great. Thanks!!!
Comment 2 by Uli Kusterer http://masters-of-the-void.com/book2.htm#comment2 http://masters-of-the-void.com/book2.htm#comment2 Uli Kusterer writes:
Lindsay, have you checked that all the #include statements are in your code? If you leave one of them out, that will cause the error you mention.
Comment 1 by Lindsay Cripps http://masters-of-the-void.com/book2.htm#comment1 http://masters-of-the-void.com/book2.htm#comment1 Great tutorial.

I'm getting an error coming up along side - fpurge( stdin );

error: 'stdin' undeclared (first use in this function)

Latest 3.1 version of Xcode