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

x
?
Solved

Clearing the Screen

Posted on 1998-12-03
6
Medium Priority
?
267 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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 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 learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

783 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