   command prompt
  Is it possible to prevent a command prompt from closing after the program is finished executing? I'm not talking about adding a line of user input at the end or whatever, but actually keeping it open after the program is done.   
  could you be a bit more specific?It's still a bit vague. I'm thinking you make a command line prompt in your application, and then when your application closes, so does your command line prompt you've coded into the app.In this case, no, because your command line in in the app you just closed.How do you use the command line prompt? What operating system are you on?   ;  The command line closing is the end of your application.  If you want to keep it open, there is no other way to keep it open other than using an std::cin, system("PAUSE") (which is probably the one you wont the least), or create an infinite loop, which is bad in a completely different way.  Best case scenario in ending an infinite loop is you end the process, worst case, you reboot your machine.   ;  If you're in Windows/C++ you might be able to call CreateProcess and launch C:\Windows\System32\cmd.exe.Not exactly the most elegant of solutions, though.  Why do you need the console to remain open, exactly?   ;  Yeah, there is the fact that you can open the EXE in command prompt.  It will remain open after that.  Still not quite as effective as just using an input.   ;  If you're in Visual Studio, you can "Run without debugging", in which case it will stay up but you won't be debugging. :-)  If you are debugging, that's what breakpoints are for.   ;  If you are on about what I think you are on about, try adding this to the main() of your c++ program:std::cout << "Press the enter Key to Exit";std::cin.ignore(std::cin.rdbuff()->in_avail() + 1);so it could look like this:#include <iostream>using namespace std;int main(){std::cout << "Hello World" << std::endl;std::cout << "Press the enter Key to Exit";std::cin.ignore(std::cin.rdbuff()->in_avail() + 1);return 0;}That should prevent the cmd window closing, and you having to press return to close it.;  Sorry to say that most of the rest of you have pretty much completely missed the mark.The OP wants to not pause the program from within the program ("I'm not talking about adding a line of user input at the end or whatever,").@BladeStone, you don't "code a command line prompt into the app". We're talking here about the command line provided by the operating system (presumably some version of Windows). The place where a console application is run from.Quote:Original post by StoryyellerIs it possible to prevent a command prompt from closing after the program is finished executing? I'm not talking about adding a line of user input at the end or whatever, but actually keeping it open after the program is done.Windows normally only keeps a command window open long enough to accomplish its purpose. You keep the window open by extending the purpose of the window.One way to do that is to open it explicitly (i.e. run cmd.exe), so that its purpose is "receive shell commands from the user". Then you use the shell (old DOS commands) to run your program.Another way is to write a batch script (basically, a list of DOS commands; Windows interprets the file as executable, and "executes" it by running the commands in turn... actually, there are some control structures, so you can program with it, but it's a really ugly language) that runs your program, and then runs the 'pause' program (that's the one that displays a "Press any key to continue..." message, and exits when you do). Then the purpose of the command window is to run the batch script, so it stays open until both programs are finished. Since 'pause' isn't finished until you "press any key", the window stays open.Another way, if you're running your program from within an IDE, is to put a breakpoint on the last line of the program. The command window stays open long enough for the debugger to do its thing, and the debugger will run most of your program and then wait for you to do something about the breakpoint (because it will always break there).   