Solved

Clearing the Screen

Posted on 1998-12-03
6
262 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
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

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
C++ assignment question 7 269
mixing C++ & C# in Vis Studio 2013 7 239
Compile GLUT with Visual Studio 2015 1 207
trigs fail! I thought I knew how to do trignometry 3 83
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
  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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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.

730 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