Hi .
i am using C++ editor to write my C code.
when i press Ctrl+F9 , the output screen comes and goes without stopping for a while.
Please note that i have included '#include<stdio.h>' and i am using 'getchar()' function do stop the screen.
Aug 06, 2015 coloured output display in c programming (dev c) - Duration: 2:31. Muhammad Saad 44,856 views.
- 6 Contributors
- forum 9 Replies
- 5,937 Views
- 19 Hours Discussion Span
- commentLatest Postby ankur_Latest Post
dkalita110
Hi .
i am using C++ editor to write my C code.
when i press Ctrl+F9 , the output screen comes and goes without stopping for a while.
Please note that i have included '#include<stdio.h>' and i am using 'getchar()' function do stop the screen.
If you are using turbo C then use getch() not getchar(). Its in the header file conio.h.
-->Definition
C++ Clear Output
Clears the console buffer and corresponding console window of display information.
Exceptions
Clear Screen In C
An I/O error occurred.
Examples
The following example uses the Clear method to clear the console before it executes a loop, prompts the user to select a foreground and background color and to enter a string to display. If the user chooses not to exit the program, the console's original foreground and background colors are restored and the Clear method is called again before re-executing the loop.
The example relies on a GetKeyPress
method to validate the user's selection of a foreground and background color.
This example demonstrates the CursorLeft and CursorTop properties, and the SetCursorPosition and Clear methods. The example positions the cursor, which determines where the next write will occur, to draw a 5 character by 5 character rectangle using a combination of '+', '|', and '-' strings. Note that the rectangle could be drawn with fewer steps using a combination of other strings.
Remarks
Clear Output Screen In Dev C Windows 7
Using the Clear method is equivalent invoking the MS-DOS cls
command in the command prompt window. When the Clear method is called, the cursor automatically scrolls to the top-left corner of the window and the contents of the screen buffer are set to blanks using the current foreground background colors.
Note
Attempting to call the Clear method when a console application's output is redirected to a file throws a IOException. To prevent this, always wrap a call to the Clear method in a try
…catch
block.