心有法竹
SetConsoleCursorPositionThe SetConsoleCursorPosition function sets the cursor position in the specified console screen buffer.该函数的作用是在特定的窗口中实现光标的定位.BOOL SetConsoleCursorPosition(HANDLE hConsoleOutput, // handle to screen buffer窗口handleCOORD 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 ValuesIf the function succeeds, the return value is nonzero.如果函数执行成功,返回非0If the function fails, the return value is zero.如果执行失败,返回0To get extended error information, call GetLastError.RemarksThe 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.