What should be used in c++ for clrscr()? as we us in c
When I put clrscr(); after variable declaration in program it is showing error
and error is that function should have a prototype.
Yes I ask for dos based console only
Thank u every body for information and I am a beginner in C and have started in dos based console borland turbo C
I think beginner forum is good for me and I asked this question bcoz it was showing output after the 1st program's o/p on same screen?
There isn't one, because the question is: Which console?
There is no the console. There is no standard. There are multiple, different terminal types, which each accept different control events. The clsscr() was for a DOS-based console.
Look up ncurses. It is a more recent library that implements some "text UI". There is some variant *curses for Windows too.
#include <windows.h>
void clear_screen()
{
DWORD n; /* Number of characters written */
DWORD size; /* Number of visible characters */
COORD coord = {0}; /* Top left screen position */
CONSOLE_SCREEN_BUFFER_INFO csbi;
/* Get a handle to the console */
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
GetConsoleScreenBufferInfo ( h, &csbi );
/* Find the number of characters to overwrite */
size = csbi.dwSize.X * csbi.dwSize.Y;
/* Overwrite the screen buffer with whitespace */
FillConsoleOutputCharacter ( h, TEXT ( ' ' ), size, coord, &n );
GetConsoleScreenBufferInfo ( h, &csbi );
FillConsoleOutputAttribute ( h, csbi.wAttributes, size, coord, &n );
/* Reset the cursor to the top left position */
SetConsoleCursorPosition ( h, coord );
}
i am aware. that doesnt mean you dont need to. im also not required to clear my gui irc screen. but i do anyways. im not required to clear my browsing history. but i do anyways