Dev C++ How To Keep Console Window Open
Like other answers have stated, the call to Console.ReadLine will keep the window open until enter is pressed, but Console.ReadLine will only be called if the debugger is attached. 1) Console.ReadLine at the end of the program. Apr 13, 2020 Dev-C v 4.9.9.2 IDE When I compile and run my program as a console project, a window flashes very briefly on the screen and disappears. The compile log says compilation was successful and execution terminated. How to I keep the window (my output window?) from disappearing? So to do something special with the console (C and C don't know what a console is, remember) means you will have to write code that is special to your operating system. Here is a function that really lets you press any key, and returns the key that was pressed. Oct 02, 2017 In this video, I show you how to pause a C console program, so you can keep that window open! The answer we cover is to use a C library function: cin.get. Another option if you want to run the Debug version and not add crap to your code is to open the console window (Start - Run - cmd) and navigate to your Debug output directory. Then, just enter the name of your executable and it will run your debug program in the console.
Definition
Sets the height and width of the console window to the specified values.
Parameters
- width
- Int32
The width of the console window measured in columns.
- height
- Int32
The height of the console window measured in rows.
How To Keep C++ Console Window Open
Exceptions
width
or height
is less than or equal to zero.
-or-
width
plus WindowLeft or height
plus WindowTop is greater than or equal to MaxValue.
-or-
width
or height
is greater than the largest possible window width or height for the current screen resolution and console font.
The user does not have permission to perform this action.
An I/O error occurred.
The current operating system is not Windows.
Examples
This example demonstrates the SetWindowSize method, and the WindowWidth and WindowHeight properties. You must run the example to see the full effect of changing the console window size. /windows-auto-tuning-feature.html.
The example reports the dimensions of a console window set to 85 columns and 43 rows, then waits for a key to be pressed. When any key is pressed, the dimensions of the console window are halved, the new dimensions are reported, and the example waits for another key press. Finally, when any key is pressed, the console window is restored to its original dimensions and the example terminates.