c winapi graphic

Cómo utilizar SetConsoleCursorPosition Func



manual de api de windows (1)

Aquí hay un ejemplo de cómo llamar a la función SetConsoleCursorPosition , tomada de cplusplus :

void GoToXY(int column, int line) { // Create a COORD structure and fill in its members. // This specifies the new position of the cursor that we will set. COORD coord; coord.X = column; coord.Y = line; // Obtain a handle to the console screen buffer. // (You''re just using the standard console, so you can use STD_OUTPUT_HANDLE // in conjunction with the GetStdHandle() to retrieve the handle.) // Note that because it is a standard handle, we don''t need to close it. HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); // Finally, call the SetConsoleCursorPosition function. if (!SetConsoleCursorPosition(hConsole, coord)) { // Uh-oh! The function call failed, so you need to handle the error. // You can call GetLastError() to get a more specific error code. // ... } }

También puede averiguar cómo usar las funciones de Win32 consultando la documentación del SDK. Buscar en Google el nombre de la función generalmente mostrará la página del documento correspondiente como primer hit.
Para SetConsoleCursorPosition , la página está aquí , y para GetStdHandle , la página está aquí .

Acabo de escribir el código para la torre de hanoi en c y quería mostrar la solución en modo gráfico usando caracteres.

Quiero usar las funciones windows.h y SetConsoleCursorPosition para mover el cursor en la consola.

¿Podrían ayudarme diciéndome si esta función funciona y cómo usarla? Por favor, den algunos ejemplos.