Solved

How to clear screen in borland C++?

Posted on 1997-08-08
1
1,711 Views
Last Modified: 2006-11-17
What do I have to type to clear the screen with Borlan C++?
0
Comment
Question by:Nectaire
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
mosfet earned 50 total points
ID: 1167040
If you want to use a C++ function, and it is in text mode, use clrscr().

If you want to use a C++ function, and you're in graphics mode, and using the built in graphics functions, use cleardevice().

If you want to write your own C++ function for text, here's one:

void clear_screen() {
 char far *scr=(char far *)0xB8000000L;
 int n;

 for (n=0;n<2000;n++) {
  scr[n*2]=0x20;
  scr[n*2+1]=0x07;
 }
}

If you want to write your own C++ function for graphics, here's one:

#define SCREEN_WIDTH ?  // Fill these in yourself
#define SCREEN_HEIGHT ?

void clear_graphics_screen() {
 char far *scr=(char far *)0xA0000000L;
 unsigned long n;

  for (n=0;n<SCREEN_WIDTH*SCREEN_HEIGHT;n++) {
   scr[n]=0;
  }
}

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

630 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