How To Clear Screen In Dev C%2b%2b

hey how to clear the screen in c++ i m using dev c++. clrscr()doesnot work

  • 6 Contributors
  • forum7 Replies
  • 184 Views
  • 2 Years Discussion Span
  • commentLatest PostLatest Postby adityatandon

Turn off all the LED lights on the LED screen. Basic.clearScreen Example: Vanishing heart. The following code shows a heart on the screen and then turns off all the LED lights. Creating a game, from start to finish. Recent additions. How to create a shared library on Linux with GCC - December 30, 2011; Enum classes and nullptr in C11 - November 27, 2011; Learn about The Hash Table - November 20, 2011; Rvalue References and Move Semantics in C11 - November 13, 2011; C and C for Java Programmers.

Recommended Answers

from MSDN:

Again, if all you want to do is clear the screen on occasion, then it is complete overkill to use Curses. (If you do use Curses, see NCurses for Unix and Linux and other POSIX systems, and PDCurses for DOS, Windows, OS/2, and some other random systems.) Using. Clear screen in dev c. C / C Forums on Bytes. How do i clear the screen using dev c. Is there a built in function, if so, what header function should i use. Please note, thi is dev c. A simple demostration of how to clear the console screen in at least Dev-C 4.9.8.0 (I don't know about the other since I've only tried it on this one, but may and probably works, with few if at all minor adjustments), what more can I say, other than it's not the best way to do it but may be useful.

Windows only …

Jump to Post

And now for the obligatory question: why do you think you need to clear the screen? There are only a handful of reasons where it makes sense outside of a GUI environment, and quite a few reasons why it's a bad idea in a textual environment (the kind of environment …

Jump to Post

All 7 Replies

Nick Evan4,005Industrious Poster Team ColleagueFeatured Poster
Editedby Nick Evan because:n/a
-->

Definition

Clears the console buffer and corresponding console window of display information.

How

Exceptions

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

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

How To Clear Screen In Dev C 2b 2b 8

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 trycatch block.

How To Clear Screen In Dev C 2b 2b 1b

Applies to