Quote:Original post by Solidus
I have completed the first chapter and my first program, GOODBYE.C. Im just wondering bout this, when I click on the goodbye.exe it opens cmd and closes in like a 1 sec. Any idea?
Console applications aren't meant to be run by double-clicking on them, but from an existing console. Open a console window (cmd.exe), cd to your executable's directory and type the program's name.
Alternatively, you can create a batch (.BAT) file with the following instructions in it.
yourprogram.exe
pause
And double-click on that instead.
People routinely do add system("pause"); at the end of their program, but I find that this is a half-baked solution : it prevents your program from being easily used from a console (remember, it is a console application), in a pipeline (where the results from one function are passed to another) or in a script (like the batch file I mentioned), since it will unconditionally wait for you to come and press a key - you won't be able to let it go off unattended.
Quote:EDIT: also this was the only book had for programing next to Sams Programing in 24hrs or something which I thought would be a little rushed... Your all making me feel like I just wasted $45 AUS ...
Don't worry about it. I, myself, have bought "OpenGL Programming for Windows 95 and Windows NT" after all. Just make the best out of what the book can teach you, but be ready to reassess what you have learned. At the very least, if you're using gcc (Dev-C++?) do make sure to compile your programs with all warnings enabled (-Wall command-line option, I don't use Dev-C++, so I don't know if there's a checkbox or something for it, though I'd assume so).
Oh, and "Learn XXX in YYY hours/minutes/days" are absolute catastrophes. So you're getting off easy. Also note that some of the people above (me included) did assume you meant C++ for Dummies - I'm less even familiar with the C of the book, though earlier comments about <dos.h> sound about right - the book probably came out when MS-DOS (including Win95) was still a prevalent OS. So keep in mind that things that might have been true ten years ago may be wrong and obsolete today. Computer science evolves quickly.
If you are looking for the canonical C book, check out "The ANSI C Programming Language" by Brian Kernighan and Dennis Ritchie. You might rely on your C for Dummies book for explanations, and on the K&R for correctness.
[Edited by - Fruny on October 9, 2004 4:17:00 AM]