Whenever I create a C program in DevC++ and don't use getchar() directly before the return statement the program disappears. Is there a compiler option or something I can change so I don't need to add this everytime?
-Fool
Printable View
Whenever I create a C program in DevC++ and don't use getchar() directly before the return statement the program disappears. Is there a compiler option or something I can change so I don't need to add this everytime?
-Fool
When you use getchar() or even getch(), you are asking for input from the stdin stream. In other words, the user has to hit a key. I think that is the only way to see the results of your program built with that compiler. In VC6 or VS.NET the programs that you build automatically wait for the user to press a key before the Command Prompt disappears.
If I get VC++ (since I'll probably be using C++ mostly later on) will it do fine using C? Also, does it come with a setup program where I can create an exe that will install my program on a friends PC?
-Fool
Yes, you can use C in VC++6. You can just as easily use C in a Win32 Console application in VC++6 than in any other compiler. You can take the executable and run it anywhere but if you have the introductory version than an automatic warning is displayed each time you run your programs. This is not a big deal but it prevents someone from illegally selling their programs. The best thing that you could do is buy the September issue of MSDN Magazine, it's currently in stores for about another week, than they will pull it off the shelf. It has VS.NET Beta 2. This compiler is the best on the planet.
Cool thanks! I go by and check that out tomo.
-Fool
The actual problem has nothing to do with your program. The "problem" is that windows (which is what you're running your program on) automaticly closes "DOS boxes" when they are finished. If you were running in DOS and didn't clear the screen when you were done, you'd see your program's contents moved up a line or so, and then the DOS prompt. The difference is that since you're running a "console application" (ie: a DOS app) it automaticly closes them.
Quzah.