繁花如伊
控制台:清屏, gotoxy#include <windows.h>#include <stdio.h>#include <string.h>void Cls(HANDLE hConsole);void gotoxy(HANDLE hOut, int x, iny y);int main(){DWORD state = 0, res;HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);Cls(hOut);gotoxy(hOut, 5, 5);printf("position: 5, 5\n");CloseHandle(hOut);}void Cls(HANDLE hConsole){COORD coordScreen = ;BOOL bSuccess;DWORD cCharsWritten;CONSOLE_SCREEN_BUFFER_INFO csbi;DWORD dwConSize;bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);dwConSize = csbi.dwSize.X * csbi.dwSize.Y;bSuccess = FillConsoleOutputCharacter(hConsole, (TCHAR) ' ', dwConSize, coordScreen, &cCharsWritten);bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);bSuccess = FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);bSuccess = SetConsoleCursorPosition(hConsole, coordScreen);}void gotoxy(HANDLE hOut, int x, iny y){COORD pos;pos.X = x;pos.Y = y;SetConsoleCursorPosition(hOut, pos); /* 设置光标位置 */}