c語言控制臺在指定位置輸出字符代碼演示如下:
#include <windows.h>void PrintChar(char *ch,UINT count,UINT x,UINT y) //在坐標(biāo)(x,y)處輸出字符串ch,ch里有count個字符{ HANDLE h=GetStdHandle(STD_OUTPUT_HANDLE); COORD pos; ULONG unuse; pos.X=x; pos.Y=y; CONSOLE_SCREEN_BUFFER_INFO bInfo; // 窗口緩沖區(qū)信息 GetConsoleScreenBufferInfo(h, &bInfo )
; WriteConsoleOutputCharacterA(h,ch,count,pos,&unuse)
;}int main(){ PrintChar("123",3,2,2); return 0;}