简体   繁体   中英

How to close the console window after the program?

I'm trying to make a program which will close the console window after execution. But it outputs this instead:

(the program output)
--------------------------------
Process exited after 15.7973 seconds with return value 0
Press any key to continue . . .

I don't want to see this message, I just want to make the program which will completely close the window .

End of my program:

   ...
   if(getch==116){
     ...
   }
   system("pause >nul");
   return 0;
}

I'm using Dev-C++.

The console window is normally closed when you run your exe with a double-click outside of IDE, or when run in debug mode with F5. Avoid the use of system("pause") or system("pause > NULL"). Avoiding "Press any key to continue" when running console application from Visual Studio

删除此行:

system("pause >nul");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM