Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Console Closing

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
6 replies to this topic

#1 Anidem   Members   

132
Like
Likes
Like

Posted 28 January 2002 - 05:25 PM

How can I keep the console from closing, ii''m using c++.

#2 Floppy   Members   

122
Like
Likes
Like

Posted 28 January 2002 - 05:30 PM

What console are you referring too? bash, ms-dos, csh, tcsh, etc.

#3 Anidem   Members   

132
Like
Likes
Like

Posted 28 January 2002 - 05:55 PM

the cmd console, which i guess is ms-dos

#4 Floppy   Members   

122
Like
Likes
Like

Posted 28 January 2002 - 06:06 PM

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;


#5 Big Sassy   Members   

311
Like
Likes
Like

Posted 28 January 2002 - 06:07 PM

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

#6 Anidem   Members   

132
Like
Likes
Like

Posted 29 January 2002 - 01:25 PM

thanks

#7 Gummo   Members   

122
Like
Likes
Like

Posted 29 January 2002 - 03:17 PM

I prefer


#include <stdlib.h>

int main()
{
system("PAUSE");
return 0;
}





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.