Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to clear screen in borland C++?

Posted on 1997-08-08
1
Medium Priority
?
1,740 Views
Last Modified: 2006-11-17
What do I have to type to clear the screen with Borlan C++?
0
Comment
Question by:Nectaire
1 Comment
 
LVL 1

Accepted Solution

by:
mosfet earned 150 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

926 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