Solved

How to clear screen in borland C++?

Posted on 1997-08-08
1
1,702 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
GUI: DIalog Stacking and Popping in MS C++ 4 98
How to convert MFC APP to Win32 APP. 19 133
Android development question 2 110
I could not set window to top 4 63
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

752 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