Advertisement

Anyone know how to use clrscr() in VC++ 6?

Started by May 17, 2001 09:30 AM
13 comments, last by Big_Bad_Bill 23 years, 8 months ago
I''m trying to make a game, and before I dive into making it graphical(I don''t really know how to do that yet.), I''m making it text-based in a DOS window. It works all fine except I don''t know how to clear the screen. In Turbo I used clrscr() which was in conio.h, but it''s not in VC++''s conio.h file. I can''t use any of VC++''s help files or documentation because for some reason it freezes up both my computers when I open it. If anyone knows where this function is or if there is another similar function, please tell me. Thanks. Bill
hmm... why not:

#define clrscr() puts("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
Advertisement
the way described above using the #define Clrscr() would work except that it would leave the cursor at the bottom of the screen. Unfortunatly I dont know the answer either, and have been tring to find out.

"There is humor in everything depending on which prespective you look from."
"There is humor in everything depending on which prespective you look from."
the way described above using the #define Clrscr() would work except that it would leave the cursor at the bottom of the screen. Unfortunatly I dont know the answer either, and have been tring to find out.

"There is humor in everything depending on which prespective you look from."
"There is humor in everything depending on which prespective you look from."
Ahhh Turbo C++, i can still remember it all so well. A year ago i went through conio withdrawal after switching to linux, so the first thing i did was make clrscr() and getch(). I don't have the code with me but i'll give it to you when i get home.






Robert Warden
Lasershot Shooting Simulations



Edited by - KlePt0 on May 17, 2001 11:16:41 AM

Edited by - KlePt0 on May 17, 2001 11:17:49 AM
Bobby Ward - COM Guru in training
To clear the screen in VC++ you use: system("cls"). The getch() function is getchar().

college student
college student
Advertisement
the only way to deal properly with console & console io stuff
like clrscr is to use the win32 ConsoleAPI (yes..there is one) ..

check msdn (msdn.microsoft.com) and look up AllocConsole()
that''s the primary console io funciton ..
quote:
Original post by rthorat

To clear the screen in VC++ you use: system("cls"). The getch() function is getchar().

college student


Actually there is a getch() function in VC++, it's in the conio.h file. But thanks for the help for clearing the screen.


Edited by - Big_Bad_Bill on May 17, 2001 2:03:58 PM
quote:
Original post by Anonymous Poster

hmm... why not:

#define clrscr() puts("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")


This was already suggested by a friend... I know that in CodeWarrior, the clrscr() function has two underscores in front of it( __clrscr() ). Does VC++ have that?
Actually there is a very easy answer to this question.
You see Microsoft being the great guys they are **cough ya right cough** included a function called system().

You can use any old dos system command by typing

system("command");

"command" can be any of the old dos commands you can even get directory and drive listings or yes, clear the screen. Hope this helped.

This topic is closed to new replies.

Advertisement