[C] function to exit the console?
popoff
-
sohaib -
sohaib -
Good evening,
I'm just looking for the function that closes the console at the end of a program. Something like system("PAUSE"); (which pauses the program) but that closes the console. Thanks.
Configuration: Windows Vista Firefox 2.0.0.11
I'm just looking for the function that closes the console at the end of a program. Something like system("PAUSE"); (which pauses the program) but that closes the console. Thanks.
Configuration: Windows Vista Firefox 2.0.0.11
8 answers
-
I don’t quite understand what you mean. But test:
system("exit");
Otherwise, when you run your program, there is no need to close the window since it closes on its own at the end of the program. (Unless you launch from the console, but in that case it will annoy the user if it closes).
So the cleanest is simply to quit the program with a simple: return 0;
Best regards
--
Google is your friend -
It is necessary to kill cmd.exe with a taskkill.
-
I don’t understand what you want to do. I think it’s impossible.
tell us the exact behavior you expect and what you want to do.
--
Salutation ! When we don’t know, we don’t touch!JBT
Char Snipeur -
Sorry to bump this old topic, but better not to recreate one ^^, I have the same problem as the person who posted it. In a party, he tries to program in C (from what I understood), and in his code he is looking for a system that allows quitting the console automatically. He took as an example system("PAUSE") which lets the program pause.
I have the same problem as him; indeed, I’m a beginner, I started yesterday, I’m following a tutorial to help me program, and the first TP consists of creating a +/- , my problem being, in the menu I’d like to have the option to start or quit ... I don’t know the command that allows closing the console <system ...=""> <=== there you go ^^ it’s not clearer, if someone could help ... :s</system> -
thank you ^^ system("exit") doesn’t work, but in the end, I just needed a method to go to the end of the program, or to finish the program => return 0; SIMPLY thank youuuuuuuuuu ^^, I’m sorry, I started yesterday so, it’s not all this easy for me yet!
-
-
Hello,
I just tested with a "return 0" at the end of my program, but the console still stays open :( -