All pastes #20621 Raw Edit

Mine

public text v1 · immutable
#20621 ·published 2005-08-21 10:56 UTC
rendered paste body
#define WINDOWS
#ifdef WINDOWS
#include <windows.h>

void clrscr(void)
{
    COORD                       coordScreen = { 0, 0 };
    DWORD                       cCharsWritten;
    CONSOLE_SCREEN_BUFFER_INFO  csbi;
    DWORD                       dwConSize;
    HANDLE                      hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleScreenBufferInfo(hConsole, &csbi);
    dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
    FillConsoleOutputCharacter(hConsole, TEXT(' '),
                               dwConSize, coordScreen, &cCharsWritten);
    GetConsoleScreenBufferInfo(hConsole, &csbi);
    FillConsoleOutputAttribute(hConsole, csbi.wAttributes,
                               dwConSize, coordScreen, &cCharsWritten);
    SetConsoleCursorPosition(hConsole, coordScreen);
}
#else
#if defined(NIX)
#include <curses.h>

void clrscr(void)
{
    static int init;

    if (init == 0)
    {
        initscr();
        init = 1;
    }

    clear();
    refresh();
}
#else
#error "Unknown Operating System!"
#endif