so sorry, i feel, for not giving the entire source code.
this was not that i had wished.
Here is the complete one..
Code:
#include <stdio.h>
#include <conio.h>
#include <Windows.h>
void cls();
int main()
{
printf("I wish to clear the screen but prior to this i would type some nuisance to it"
"\n so that i find the screen cleared as before. So i have written the utility\n"
" Yes, I cud have used \" system (cls) \" function but i wanted my own utility.\n"
"\n I also wanted it to be fail proof. I have been using this utility for about"
"\n 2 months. It suffers some limitations ,i know ,but i still want others to "
" \n do me favors making it good.\n");
printf("\n\t\tPress any key clear the screen\n");
int p=getch();
cls();
printf("\n Hope now u get what I meant.\n");
printf("\n\t\t Press any key clear the screen\n");
p=getch();
cls();
int k=getch();
return 0;
}
void cls()
{
POINT pt;
HDC hdc;
MoveToEx(hdc,0,0,&pt);
HANDLE hConsoleOut;
DWORD dummy;
COORD Home = { 0, 0 };
hConsoleOut = GetStdHandle( STD_OUTPUT_HANDLE );
FillConsoleOutputCharacter(
hConsoleOut, ' ', pt.x * pt.y, Home, &dummy );
pt.x=0;
pt.y =0;
MoveToEx(hdc,pt.x,pt.y ,&pt);
}
I infact want it to be free of errors and better .. Any suggestion to make it better would be a highness.