void clrscr(int x,int y)
{
HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
//MyCls(hStdOut);
//HANDLE hConsole=hStdOut;
COORD coordScreen={x,y};//设置清屏后光标返回的屏幕左上角坐标
BOOL bSuccess;
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;//保存缓冲区信息
DWORD dwConSize;//当前缓冲区可容纳的字符数
bSuccess=GetConsoleScreenBufferInfo(hConsole,&csbi);//获得缓冲区信息
//PERR(bSuccess,"GetConsoleScreenBufferInfo");
dwConSize=(csbi.dwSize.X-x) * (csbi.dwSize.Y-24);//(缓冲区容纳字符数目)要清空的面积,X是列数减去6列,Y默认是25,减去
//24等于1,x默认是80减去6等于74,因为光标定位在第0行第6列,所以就是
//清空第0行的第7列开始到第0行的结尾
//dwConSize=csbi.dwSize.X * csbi.dwSize.Y;
//用空格填充缓冲区
bSuccess=FillConsoleOutputCharacter(hConsole,(TCHAR)' ',dwConSize,coordScreen,&cCharsWritten);
//PERR(bSuccess,"FillConsoleOutputCharacter");
bSuccess=GetConsoleScreenBufferInfo(hConsole,&csbi);//获得缓冲区信息
//PERR(bSuccess,"ConsoleScreenBufferInfo");
//填充缓冲区属性
bSuccess=FillConsoleOutputAttribute(hConsole,csbi.wAttributes,dwConSize,coordScreen,&cCharsWritten);
//PERR(bSuccess,"FillConsoleOutputAttribute");
//光标返回屏幕左上角坐标
bSuccess=SetConsoleCursorPosition(hConsole,coordScreen);
//PERR(bSuccess,"SetConsoleCursorPosition");
return;
}
{
HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
//MyCls(hStdOut);
//HANDLE hConsole=hStdOut;
COORD coordScreen={x,y};//设置清屏后光标返回的屏幕左上角坐标
BOOL bSuccess;
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;//保存缓冲区信息
DWORD dwConSize;//当前缓冲区可容纳的字符数
bSuccess=GetConsoleScreenBufferInfo(hConsole,&csbi);//获得缓冲区信息
//PERR(bSuccess,"GetConsoleScreenBufferInfo");
dwConSize=(csbi.dwSize.X-x) * (csbi.dwSize.Y-24);//(缓冲区容纳字符数目)要清空的面积,X是列数减去6列,Y默认是25,减去
//24等于1,x默认是80减去6等于74,因为光标定位在第0行第6列,所以就是
//清空第0行的第7列开始到第0行的结尾
//dwConSize=csbi.dwSize.X * csbi.dwSize.Y;
//用空格填充缓冲区
bSuccess=FillConsoleOutputCharacter(hConsole,(TCHAR)' ',dwConSize,coordScreen,&cCharsWritten);
//PERR(bSuccess,"FillConsoleOutputCharacter");
bSuccess=GetConsoleScreenBufferInfo(hConsole,&csbi);//获得缓冲区信息
//PERR(bSuccess,"ConsoleScreenBufferInfo");
//填充缓冲区属性
bSuccess=FillConsoleOutputAttribute(hConsole,csbi.wAttributes,dwConSize,coordScreen,&cCharsWritten);
//PERR(bSuccess,"FillConsoleOutputAttribute");
//光标返回屏幕左上角坐标
bSuccess=SetConsoleCursorPosition(hConsole,coordScreen);
//PERR(bSuccess,"SetConsoleCursorPosition");
return;
}
clrscr(0,0);
printf("count = %d",cc);