How to clear screen

Posted on 2001-07-27
Last Modified: 2011-10-03
How do I clear the screen.
Found code that uses <dos.h> and int86 function
but can't get it to work.
Any assistance would be appreciated.
Question by:kapai
LVL 10

Accepted Solution

makerp earned 200 total points
ID: 6326424
what compiler

borland has clrscr(); i think

a dirty way to do it is


or use the windows console API


Expert Comment

ID: 6326548
If you're using VC++ there is a way round it. See code at the following URL.

To call this you'll need the console handle which you get by calling GetStdHandle (I think).


Expert Comment

ID: 6326617
if you have loaded ANSI.SYS (by adding device=ansi.sys to config.sys), you can simply puts("\x1B[2J");

Author Comment

ID: 6328833
Thanks guys, first in with easiest option wins.
Appreciate other suggestions but still a little over my head to use.

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Performance degradation with linux shared library 6 135
Way to improve it 16 61
How to set environment variables in C 2 78
C hashtable library 3 82
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now