Use the C language to implement output at a specified position in the Win console.
There is a GotoXY in the ancient Turbo C that allows you to output text in the specified coordinates. What is hateful is the C language books I have read, and half of them are about it. I am using a Windows system. It is impossible for me to write DOS programs. At least I have to start with the Windows console program. So I collected more information and finally found a Windows console program API to jump to a specified location for output.
# Include <stdio. h> # include <Windows. h> # include <conio. h> # include <stdlib. h> int main () {int I; HANDLE hOut; COORD pos = {0, 0}; hOut = GetStdHandle (STD_OUTPUT_HANDLE); CONSOLE_CURSOR_INFO cci; // defines the struct GetConsoleCursorInfo (hOut, & cci); // obtain the cursor information cci. dwSize = 1; // set the cursor size cci. bVisible = 0; // set the cursor to invisible FALSE SetConsoleCursorInfo (hOut, & cci); // set (Application) The cursor information SetConsoleTextAttribute (hOut, 0x0004 | 0x0008 | 0x8000 ); // set the font attribute pos. X = 5; pos. Y = 5; SetConsoleCursorPosition (hOut, pos); // set the cursor coordinate printf ("Here % 2d %", 0); pos. X = 13; pos. Y = 5; SetConsoleCursorPosition (hOut, pos); getch (); for (I = 0; I <= 100; I ++) {SetConsoleCursorPosition (hOut, pos ); printf ("% 2d %", I); Sleep (500);} return 0 ;}