There's a gotoxy in the old Turbo C that lets you output text in the specified coordinates, and hateful is the C language book I've read, and half of it's about it. I now use the Windows system, it is impossible to let me write the DOS program ah, at least from the win console program to start AH. So search n More information, finally found a Windows Console program API can be implemented to jump to the specified location for output.
#include <stdio.h>#include<Windows.h>#include<conio.h>#include<stdlib.h>intMain () {inti; HANDLE HOut; COORD POS= {0,0}; HOut=GetStdHandle (Std_output_handle); Console_cursor_info CCI; //Define structure BodyGetconsolecursorinfo (HOut, &cci);//Get cursor InformationCci.dwsize =1;//set the cursor sizeCci.bvisible =0;//set cursor not visible FALSESetconsolecursorinfo (HOut, &cci);//Set (apply) cursor informationSetconsoletextattribute (HOut,0x0004|0x0008|0x8000);//Set font PropertiesPos. X =5; Pos. Y=5; SetConsoleCursorPosition (Hout,pos); //Set CURSOR coordinatesprintf"I'm here to%2d%% .",0); Pos. X= -; Pos. Y=5; SetConsoleCursorPosition (Hout,pos); Getch (); for(i=0; i<= -; i++) {setconsolecursorposition (Hout,pos); printf ("%2d%%", i); Sleep (5xx); } return 0;}
Implementing the specified position output in the win console using the C language