Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Console Closing

This topic is 5956 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Ok, so I guess your using Windows. Well, the easiest way I suppose is to use getchar to wait for a key to be pressed; when the key is pressed the program exits. For example:
  
#include <stdio.h>

int main()
{
// Some code


// Wait for some input from the keyboard

getchar();

// Exit the program by closing the console

return 0;

Share this post


Link to post
Share on other sites
You could always inlude conio.h and put getch() at the end of your code

    

#include <conio.h>

void main()
{
// do stuff

getch();
}


EDIT - Whoops. Looks like Floppy beat me too it. They both basically do the same thing. Have fun

Edited by - Big Sassy on January 29, 2002 1:09:24 AM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!