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

x
?
Solved

Clearing the Screen

Posted on 1998-12-03
6
Medium Priority
?
266 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 200 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
Independent Software Vendors: 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

Independent Software Vendors: 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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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.

688 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