Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to clear screen in borland C++?

Posted on 1997-08-08
1
Medium Priority
?
1,726 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 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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

670 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