• win32 获取控制台句柄、cls


    GetStdHandle(STD_OUTPUT_HANDLE);

    #undef X
    #undef Y
    
    void cls(void)
    {
    	COORD coordScreen = { 0, 0 };	 /* here's where we'll home the
    													cursor */
    	DWORD cCharsWritten;
    	CONSOLE_SCREEN_BUFFER_INFO csbi; /* to get buffer info */
    	DWORD dwConSize;					  /* number of character cells in
    													the current buffer */
     
    	/* get the number of character cells in the current buffer */
     
    	GetConsoleScreenBufferInfo( hOut, &csbi );
    	dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
     
    	/* fill the entire screen with blanks */
     
    	FillConsoleOutputCharacter( hOut, (TCHAR)' ',
    		dwConSize, coordScreen, &cCharsWritten);
     
    	/* get the current text attribute */
     
    	GetConsoleScreenBufferInfo( hOut, &csbi );
     
    	/* now set the buffer's attributes accordingly */
     
    	FillConsoleOutputAttribute( hOut, csbi.wAttributes,
    		dwConSize, coordScreen, &cCharsWritten );
     
    	/* put the cursor at (0, 0) */
     
    	SetConsoleCursorPosition( hOut, coordScreen );
    }
    

      

  • 相关阅读:
    java降序排列
    冒泡排序-java
    redis-并发竞争问题
    超卖问题
    算法-题目汇总-6
    算法-题目汇总-4
    算法-题目汇总-1
    算法-二分查找-1
    算法-bst-平衡搜索二叉树-1
    算法-位运算-1
  • 原文地址:https://www.cnblogs.com/ageane/p/hOut.html
Copyright © 2020-2023  润新知