Solved

Clearing the Screen

Posted on 1998-12-03
6
263 Views
Last Modified: 2006-11-17
I have a program in c++ using dos windows.  I would like to know the syntax of clearing the screen between my menus.  I believe I have to use the dos.h, but do not know the code for doing this.          
                                  Thanks
0
Comment
Question by:macro091998
[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
  • 2
  • 2
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
trillo earned 50 total points
ID: 1179170
use the clrscr function defined in conio.h

#include <conio.h>
void clrscr(void);

Trillo
0
 

Author Comment

by:macro091998
ID: 1179171
I tried using conio.h and the function void clrscr(void).  It compiled alright, but it would not link.  It had two errors:  Sales array.obj : error LNK2001: unresolved external symbol "void __cdecl clrscr(void)" (?clrscr@@YAXXZ), and Debug/CPP_CLASS.exe : fatal error LNK1120: 1 unresolved externals

It stops linking at the function call.  I also think conio.h is a Borland library function.  I'm using Visual C++ 6.0  If you now something that could help me, let me know...
       
THANKS
Macro

0
 
LVL 2

Expert Comment

by:trillo
ID: 1179172
Hmmm..... you're right, that's Borland's.... I've looked around and I came to the conclusion that Microsoft doesn't have anything equivalent for clrscr().
You could try using the "system" function, (I think it's defined in <stdlib.h>) and passing the "cls" DOS command...

{
   ...
   system("cls");
   ...
}

Not very good, huh? (At least not as good as clrscr), but it may be a soultion..

Trillo
0
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!

 
LVL 22

Expert Comment

by:nietod
ID: 1179173
The problem is that your are not writing a DOS program.  VC 6 does not support DOS.  (VC 2 and later don't support DOS).

You are writting a win 32 console program.  This is a windows program (it can have windows like any other) but by default starts with a console window that displays text like a DOS program does.  (However, it can do much more.)  I recomend you look up console programs in the docs to see that it is that you really are workign woth.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1179174
To get started, look up "Consoles and Character Mode Supprt"

I don't see any procedure for clearing the screen.  But you can write one using SetConsoleCursorPosition() and WriteConsole().  You could also use WriteConsoleOutput().  (There are a lot of ways, actually.  You need to do some research.)

Let me know if you have questions.

0
 

Author Comment

by:macro091998
ID: 1179175
trillo,
  Using the <stdlib.h> and system("cls") worked great... THANKS  macro
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 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.

726 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