I went to FAQs and there ways don't work. The only one that works is throwing the monitor out the window. If anyone has a suggestion please let me know.
I went to FAQs and there ways don't work. The only one that works is throwing the monitor out the window. If anyone has a suggestion please let me know.
Compiler and OS?
-Govtcheez
[email protected]
#include <mem.h>
unsigned char * vga = NULL; // pointer to vga mem
vga = (unsigned char *) 0xA000; // set it
void clearscreen (int colour) {
memset(vga, col, (width * height) converted to hex);
}
remember this will leave your screen cleared, so if you cleared it to colour 4 you would get a blank red screen, and you would need to cout << some text over it, remembering that text is WHITE!
this function might not work unless you have set a resolution IN your program yourself ie.
asm xor ah, ah
asm mov al, 0x13
asm int 10h
places you in 320 * 200 mode and the clearscreen func would be
memset(vga, col, 0xFA00);
0xFA00 = 320 * 200 (converted to hex (use windows calculator))
Hope this helps
UncleG
Well in Vis C++ (version 6, at least) you can do:
Not sure what library files you need, maybe windows.hCode:system("cls")
Before you criticise a man, walk a mile in his shoes. Then, when you criticise him, you're a mile away. And you have his shoes.
To clear screen in DOS text mode:
clrscr() <conio.h>
To clear screen in DOS BGI:
cleardevice() <graphics.h>
To clear screen permanently:
Throw the monitor out the window.
//
void clrscr();//Prototype for the clear screen function
int main()
{
cout << "whatever";//Text to screen
clrscr();//Calls to clear the screen
return 0;
}
void clrscr() //Clears the screen
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
}
~Silencer~
What is this "C.O.D.E." you speak of?