Siimple c question
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 :)
Hi Drew,
Thanks but i dont think that is c. I get a compiler error as it doesn't recognize system.
Thanks but i dont think that is c. I get a compiler error as it doesn't recognize system.
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>
It's really bad form, anyway. Console programs are meant to be run from the console and should close when they're finished.
#include <conio.h>
getch() is a favorite of mine (dunno if its standard or not though)
hope that helps
-Dan
getch() is a favorite of mine (dunno if its standard or not though)
hope that helps
-Dan
Thanks guys
System(pause) works nicely
Programs are supposed to run the way you want them to :)
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 :)
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement