My window will not clear itself (vc++)'s an interesting problem. I am using Visual C++ (6.0). Well....I am trying to get my window to clear ( in a console app. ). Well, at school (that uses Borland C++ 5.01) I've always used clrscr() from the conio.h file. But....when I include the header file and try and use the doesn't work, and gives me one or more (typically more) errors. What's wrong and what should I be doing that I'm not?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try including conio.c

Your conio at home might be not be including the actual implementation of conio.

What are your errors?

If that still doesn't work, try:

and you'll need stdlib.h

Hope this helps.
Mayank SAssociate Director - Product EngineeringCommented:
Conio.h is screen-based, whereas Visual C++ is window-based. But I guess when you excute a new program, it starts automatically in a cleared window.

This question is pretty often.

For years I've been using Borland C++ and can not imagine how hard is life without clrscr(), gotoxy(), textcolor() etc.

I can't believe Microsoft can not make it. Is there some license issue or something ?
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Mayank SAssociate Director - Product EngineeringCommented:
That's why I prefer to work with Java. Its also platform-independent. But VC must be having some equivalent method I'm unaware of.

It is rather silly to try to do GUI stuff in a console app (which is why Microsoft does not bother to supply a high-level library of fns like cls and the beloved Borland gotoxy -- what is this, 1985?).  But there is a complete set of primitives one can use to manipulate the console.  For instance, here is a cls() fn and an example of usage.

#include <windows.h>
#include <stdio.h>   // for printf

void cls()
     HANDLE hConScreen=  GetStdHandle( STD_OUTPUT_HANDLE );

     GetConsoleScreenBufferInfo(hConScreen, &rCBI );
     int nScreenBytesTotal= rCBI.dwSize.X * rCBI.dwSize.Y;


     COORD pt; pt.X=0; pt.Y=0;
     DWORD nActual;
     FillConsoleOutputCharacter( hConScreen, ' ', nScreenBytesTotal, pt, &nActual );
     FillConsoleOutputAttribute( hConScreen, ClrWhiteOnBlack , nScreenBytesTotal, pt, &nActual );

void main()
     printf("hi there\n");
     printf("hi there\n");
     printf("hi there\n");
     printf("hi there\n");
     printf("hi there\n");
     printf("hi there\n");
     printf("hi there\n");

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: DanRollins

Please leave any comments here within the next seven days.


EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.