0

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++.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055

2 Answers2

0

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

Community
  • 1
  • 1
StelI0z
  • 16
  • 2
  • "The console window is normally closed when you run your exe with a double-click outside of IDE" -> That's the reason?? Really?? Anyways, thank you! :-) Btw. I'm using DevC++, not Visual Studio – 화이트케이크 Feb 13 '16 at 21:50
0

Remove this line:

system("pause >nul");
Misa Lazovic
  • 2,805
  • 10
  • 32
  • 38
kvr
  • 573
  • 2
  • 8