Everyday for the last two months I've found threads started by newbies concerning this topic:
How do I keep a window from closing?
My window closes automatically, help!!!
How do I prevent a window from closing fast?
Well, I've made this topic to help answer that. So that when newbies could look at this topic before they post.
For the Dev-C++4 IDE(Compiler: MingW), and some others. The functions to keep a window from closing are as follow:
1. system("pause");
2. Sleep(number_of_Miliseconds);
3. getch();
4. getchar();
5. cin.get();
----------------------------------------------------
1. Include stdlib.h, this is really a C function
2. Include windows.h, the function name is case sensative. The S must be capitalized. Place the number of miliseconds in the paranthesees. This is bad practice using this function as a window close preventer, but it is possible.
3. Include conio.h(conio.c in Dev-C++), place this before return 0;
4. Same as getch();
5. Most advance programmers use this. Most programmers would say that cin.get is the best way.
[GB Edit: ] Mods, it wouldn't hurt to stick this topic. It is helpful. Also if there are any programming mistakes within this topic. Feel free to edit it. The newbies will read it so it has to be perfect.