• Advertisement
Sign in to follow this  

Siimple c question

This topic is 4724 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

Hi, could someone please tell me what function pauses a console program to stop it from dissapearing at the end. Is it readln() or something like that? Thanks :)

Share this post


Link to post
Share on other sites
Advertisement
Hi Drew,
Thanks but i dont think that is c. I get a compiler error as it doesn't recognize system.

Share this post


Link to post
Share on other sites
Quote:
Original post by one mind
Hi Drew,
Thanks but i dont think that is c. I get a compiler error as it doesn't recognize system.


system() is a standard C function... Your OS may not have a pause command/program, though.

You need to #include <stdlib.h>

Share this post


Link to post
Share on other sites
It's really bad form, anyway. Console programs are meant to be run from the console and should close when they're finished.

Share this post


Link to post
Share on other sites
#include <conio.h>

getch() is a favorite of mine (dunno if its standard or not though)

hope that helps
-Dan

Share this post


Link to post
Share on other sites
Thanks guys
System(pause) works nicely

Quote:
It's really bad form, anyway. Console programs are meant to be run from the console and should close when they're finished.


Programs are supposed to run the way you want them to :)

Share this post


Link to post
Share on other sites
Quote:
Original post by one mind
Programs are supposed to run the way you want them to :)


The proper way to do it is to create a batch file that runs your program and then calls pause.

Share this post


Link to post
Share on other sites
while(1) {}

?

(also, if you want something thats really annoying while(1) {printf('\b\n');} )
From,
Nice coder.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement