• Windows,Clearing the Screen,cls


    #include <windows.h>
    
    void cls( HANDLE hConsole )
    {
       COORD coordScreen = { 0, 0 };    // home for the cursor 
       DWORD cCharsWritten;
       CONSOLE_SCREEN_BUFFER_INFO csbi; 
       DWORD dwConSize;
    
    // Get the number of character cells in the current buffer. 
    
       if( !GetConsoleScreenBufferInfo( hConsole, &csbi ))
       {
          return;
       }
    
       dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
    
       // Fill the entire screen with blanks.
    
       if( !FillConsoleOutputCharacter( hConsole,        // Handle to console screen buffer 
                                        (TCHAR) ' ',     // Character to write to the buffer
                                        dwConSize,       // Number of cells to write 
                                        coordScreen,     // Coordinates of first cell 
                                        &cCharsWritten ))// Receive number of characters written
       {
          return;
       }
    
       // Get the current text attribute.
    
       if( !GetConsoleScreenBufferInfo( hConsole, &csbi ))
       {
          return;
       }
    
       // Set the buffer's attributes accordingly.
    
       if( !FillConsoleOutputAttribute( hConsole,         // Handle to console screen buffer 
                                        csbi.wAttributes, // Character attributes to use
                                        dwConSize,        // Number of cells to set attribute 
                                        coordScreen,      // Coordinates of first cell 
                                        &cCharsWritten )) // Receive number of characters written
       {
          return;
       }
    
       // Put the cursor at its home coordinates.
    
       SetConsoleCursorPosition( hConsole, coordScreen );
    }
    
    int main( void )
    {
        HANDLE hStdout;
    
        hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    
        cls(hStdout);
        
        return 0;
    }
  • 相关阅读:
    WebXml.com.cn 中国股票行情数据 WEB 服务(支持深圳和上海股市的全部基金、债券和股票),数据即时更新
    新浪股票接口AndroidSDK
    Java Applet使用
    Java反射机制
    Java中HashMap排序
    C#委托和事件
    Java操作XML
    迭代器模式
    C# 天气预报
    ptypes中string类的空间分配
  • 原文地址:https://www.cnblogs.com/threef/p/3201966.html
Copyright © 2020-2023  润新知