为了账号安全,请及时绑定邮箱和手机立即绑定

我下了一个gotoxy()函数,不过我不理解,请问是什么意思?

我下了一个gotoxy()函数,不过我不理解,请问是什么意思?

C
BIG阳 2022-10-20 15:15:24
void gotoxy(int a, int b){COORD c;c.X=a;c.Y=b;SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);}COORD什么意思还有SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c)什么意思啊?多谢啊。
查看完整描述

1 回答

?
心有法竹

TA贡献1866条经验 获得超5个赞

SetConsoleCursorPosition
The SetConsoleCursorPosition function sets the cursor position in the specified console screen buffer.
该函数的作用是在特定的窗口中实现光标的定位.
BOOL SetConsoleCursorPosition(
HANDLE hConsoleOutput, // handle to screen buffer窗口handle
COORD dwCursorPosition // new cursor coordinates光标的坐标
);
Parameters变量
hConsoleOutput
[in] Handle to a console screen buffer. The handle must have GENERIC_WRITE access.
指向窗口的handle,必须有GENERIC_WRITE的权利
dwCursorPosition
[in] Specifies a COORD structure containing the new cursor position. The coordinates are the column and row of a screen buffer character cell. The coordinates must be within the boundaries of the screen buffer.
包含一个光标的坐标.坐标位置必须不超出窗口.
Return Values
If the function succeeds, the return value is nonzero.
如果函数执行成功,返回非0
If the function fails, the return value is zero.
如果执行失败,返回0
To get extended error information, call GetLastError.

Remarks
The cursor position determines where characters written by the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function, are displayed. To determine the current position of the cursor, use the GetConsoleScreenBufferInfo function.

If the new cursor position is not within the boundaries of the screen buffer's window, the window origin changes to make the cursor visible.


查看完整回答
反对 回复 2022-10-24
  • 1 回答
  • 0 关注
  • 74 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信