目录
函数接口
作用:
测试结果1
测试代码2
测试结果2
函数接口BOOL WINAPI SetConsoleCursorPosition(
_In_ HANDLE hConsoleOutput,
_In_ COORD dwCursorPosition
);
实现控制台光标定位
测试代码1#include
#include
int main()
{
COORD pos = { 15,5 };
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut, pos);
SetConsoleTextAttribute(hOut, 0x01 | 0x05);
printf("HelloWorld!n");
return 0;
}
#include
#include
int main(){
COORD pos = { 0,0 };
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hOut, 0x01 | 0x05);
for (int i = 0; i < 20; i++){
pos.X = i;
pos.Y = i;
SetConsoleCursorPosition(hOut, pos);
printf("%d%d:HelloWorld!n", pos.X, pos.Y);
Sleep(1000);
}
return 0;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)