Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to clear screen in Visual C++

Status
Not open for further replies.

mcole1213

Instructor
Feb 18, 2003
1
US
I have recently converted over from Turbo to Visual and can not figure out the clear screen. I have no references for Visual and the techs have not loaded help files. My students need for their programs.
 
system("CLS") Is Quick And Easy, And It Dosen't Require Any Header Files.
 
heyyy...
i thought that system("CLS") took a header file...
#include<stdlib.h>
may just be my compiler that deems it necessary, but hey, thought that i'd jump in
~Thani
 
I had this same original question. How do you clear the screen? I tried the above suggestions. &quot;cls&quot; produces an &quot;undeclared identifier&quot; error. I tried it with and without the suggested header file; in lower-case and upper-case letters; and with and without empty parentheses. Also, &quot;cls&quot; is not in the help index. What's the explanation here?

Thanks.
 
zytryt, If your compiler is not complaining about stdlib.h then it must be finding it okay. In that case system(&quot;CLS&quot;) should work.

'system' must be in lowercase. The case of 'CLS' is irrelevant.

Can you paste your code?
 
the library #include<conio.h> has the function clrscr() which is supposed to clear the screen.
also helpful, in the same library, is the clreol() function, which clears the line, starting at the current cursor position.
i don't have acess to the <conio.h> library, and when my compiler deems me worthy, these commands don't work, but for you it may. it may also be a lvp file; seek, my friend and you shall find!
good luck!
~ThaniCC
 
<conio.h> is not a library. It is a header file...
The library this header contains definitions for is extremely dependent to the compiler you use.
But since this is VC++ forum, that library is called LIBC.LIB and it is statically linked automatically to each and every program one write in MSVC. It is part of the C Run-time libraries that contain all the C goodies one should never write on his own (like memory allocation functions, string manipulations anso.) unless he's crazy for ASM.
Cheers...

[red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top