问题补充说明:voidgotoxy(intx,inty)//x为列坐标,y为行坐标{COORDpos={x,y};HANDLEhOut=GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(hOut,pos);}这些语句代表什么,在哪个包里?... void gotoxy(int x, int y)//x为列坐标,y为行坐标{COORD pos = {x,y};HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(hOut, pos);} 这些语句代表什么,在哪个包里? 展开
亚况控制台:清屏,goto述xy
#include<windows.h>
#include<stdio.h>
#include<stri答压松怀零苏求家微家ng.h>
voidCls(HANDLEhConsole);
voidgotoxy(HANDLEhOut,intx,inyy);
intmain()
{
DWORDstate=0,res;
HANDLEhOut=GetStdHandle(STD_OUTPUT_HANDLE);
Cls(hOut);
gotoxy(hO证模坐盾才ut,5,5);
printf("position:5,5\n")这句;
CloseHandle(hOut);
}
voidCls(HANDLEhConsole)
{
COORDcoordScreen=;
BOOLbSuccess;
DWORDcCharsWritten;
CONSOLE合意轻试亚映衣晚_SCREEN_BUFFER_INFOcsbi;
DWORDdwConSi临划通械无附利著呢着志ze;
bSuccess=Ge座植支香显tConsoleScreenBufferInfo(hConsole,&csbi);
dwConSize=csbi.dwSize.X*csbi.dwSize.念余Y;
bSuccess=FillConsoleOutputCharacter(hConsole,(TCHAR)'',dwConSize,coordScreen,&cCharsWritten);
bSuccess=GetConsoleScreenBufferInfo(hCo同末亮充药委己获死nsole,&csbi);
bSucc光文管阶何获轮酸并ess=FillConsoleOutputAttribute(hConsole,csbi.wAttributes,dwConSize,coordScreen,&cCharsWritten);
bSuccess=SetConsoleCursorPosition(hConsole,coordScreen);
}
voidgotoxy(HANDLEhOut,intx,inyy)
{
COORDpos;
pos.X=x;
po步s.Y=y;
SetConsoleCursorPosition(hOut,pos);/*设置光标位置*/
}
标签:CHANDLE,hOut,GetStdHandle