Thread: Largest screen buffer size?

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    119

    Largest screen buffer size?

    When clearing the screen using the win32 console, with windows.h, there is a command called FillConsoleOutputCharacter and one of the arguments is how many characters to output. I noticed that for my particular monitor 4000 spaces clears the screen perfect. However, the tutorial that taught me how to do this also told me that some monitors have a 5500 screen buffer size...I was just curious as to what is the largest screen buffer size possible, so that I won't make it too small if my program is running on someone else's computer.

    Either that, or a way to find out what size your screen buffer is...I've noticed that putting a higher number than what you need doesn't hurt anything, for instance, mine is 4000, but if I put 6000 it still works fine, so if I knew the largest possible, I'd just put that and know it would work fine on any comp....

    Thanks as always, Ash

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Code:
    HANDLE hConsole;
        DWORD  dwNumberCharsWritten = 0;
        CONSOLE_SCREEN_BUFFER_INFO Console_Screen_Buffer_Info;
        COORD TopLeft = {0, 0};
    
        hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
        GetConsoleScreenBufferInfo(hConsole, &Console_Screen_Buffer_Info);   
        FillConsoleOutputCharacter(hConsole, ' ', 
            Console_Screen_Buffer_Info.dwSize.X * Console_Screen_Buffer_Info.dwSize.Y, TopLeft, &dwNumberCharsWritten);
        SetConsoleCursorPosition(hConsole, TopLeft);

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    119
    thanks, you rock!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Get file size when in buffer
    By Siphon in forum C++ Programming
    Replies: 10
    Last Post: 04-10-2008, 10:52 AM
  2. Heapsort
    By xENGINEERx in forum C Programming
    Replies: 2
    Last Post: 03-30-2008, 07:17 PM
  3. Replies: 4
    Last Post: 09-23-2005, 10:51 AM
  4. error: identifier "byte" is undefined.
    By Hulag in forum C++ Programming
    Replies: 4
    Last Post: 12-10-2003, 05:46 PM
  5. Tetris Questions
    By KneeGrow in forum Game Programming
    Replies: 19
    Last Post: 10-28-2003, 11:12 PM