Advertisement

SetConsoleCursorPosition函数如何设置光标位置

阅读量:

目录

函数接口

功能:

测试代码1

测试结果1

测试代码2

测试结果2

函数接口设计与实现

BOOL****WINAPI****SetConsoleCursorPosition( InHANDLEhConsoleOutput, ****InCOORDdwCursorPosition );

作用:

达成对控制台光标位置的精准设定

测试代码1

|#include****< stdio.h> #include**< windows.h>** int****main() { COORDpos = { 15,5 }; HANDLEhOut = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hOut, pos); SetConsoleTextAttribute(hOut, 0x01|0x05); printf("HelloWorld!\n"); *****return

全部评论 (0)

还没有任何评论哟~