CLS in C++...
ok,... this should be the easiest question out there... "yet no one can answer it."
How do you Clear the screen in win32app? "DOS scean?"
I have a text thingy, and i would like to clean the screen when i am done... i have asked this question ever sense ive started C++ and no one could answer it.
as for why im doing this "i like to learn all the basics and stuff before jumping into the big stuff"
Thanks all!
~Xier
ps... CLS is clear screan QBasic
Well, in DJGPP I remember there being a clrscr (sp?) function in conio.h, but it isn''t there in VC++ (that I''ve found). The next closest thing would be system("cls"). system should be declared in process.h or stdlib.h.
Well, if cls is in one of those header, what would the syntax look like? just a plane old:
cls; // ?
Thanks for the help!
~xier
cls; // ?
Thanks for the help!
~xier
#include <stdlib.h> // Required includesystem("cls"); // Clear the screen
_____________________________________________________
ICQ #: 149510932
Google - OpenGL - DirectX - Windows Guide Network - MSDN - Symantec Virus Info
"Imagination is more important than knowledge." - Albert Einstein
You could make your own cls function.
-Forcaswriteln("Does this actually work?");
quote: Original post by Xier
ok,... this should be the easiest question out there... "yet no one can answer it."
Are you suggesting that all of humanity cannot provide an answer to this question? If no one can answer it, why are you asking?
Going to the MDSN and searching for "clear screen console" provided this bit of code :
Iain Hutchison
Programmer, Silicon Dreams
The views expressed here are my own, not those of my employer.
[edited by - pieman on April 11, 2002 10:43:49 AM]
#include <windows.h>#include <stdio.h>#include <string.h>#include <stdlib.h>#include "console.h"void cls() { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); COORD coordScreen = { 0, 0 }; /* here's where we'll home the cursor */ BOOL bSuccess; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; /* to get buffer info */ DWORD dwConSize; /* number of character cells in the current buffer */ /* get the number of character cells in the current buffer */ bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi); if (!bSuccess) return; dwConSize = csbi.dwSize.X * csbi.dwSize.Y; /* fill the entire screen with blanks */ bSuccess = FillConsoleOutputCharacter(hConsole, (TCHAR) ' ', dwConSize, coordScreen, &cCharsWritten); if (!bSuccess) return; /* get the current text attribute */ bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi); if (!bSuccess) return; /* now set the buffer's attributes accordingly */ bSuccess = FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); if (!bSuccess) return; /* put the cursor at (0, 0) */ bSuccess = SetConsoleCursorPosition(hConsole, coordScreen); if (!bSuccess) return; return;}
Iain Hutchison
Programmer, Silicon Dreams
The views expressed here are my own, not those of my employer.
[edited by - pieman on April 11, 2002 10:43:49 AM]
Iain HutchisonProgrammer, Silicon DreamsThe views expressed here are my own, not those of my employer.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement