A clear screen C ++ code (reposted)

xiaoxiao2021-03-06  104

A clear screen C code (reposted)

// clrscr.h

//

// adapted from

// vincent fatica

// vefatica@syr.edu

// Syracuse University Mathematics

// http://barnyard.syr.edu/~vefatica/

//

// by Shannon Bauman

// August 9, 1998

//

// Clear Entire Console Screen Buffer

#ifndef CLRSCR_H

#define CLRSCR_H

INT CLRSCR ();

#include "clrscr.cpp"

#ENDIF

-----------------

// clrscr.cpp

//

// adapted from

// vincent fatica

// vefatica@syr.edu

// Syracuse University Mathematics

// http://barnyard.syr.edu/~vefatica/

//

// by Shannon Bauman

// August 9, 1998

//

// Clear Entire Console Screen Buffer

#include

#include

Int CLRSCR ()

{

Handle hndl = getstdhandle (std_output_handle);

Console_screen_buffer_info csbi;

GetConsolescreenBufferInfo (HNDL, & CSBI);

DWORD WRITTEN

DWord n ​​= csbi.dwsize.x * csbi.dwcursorPosition.y

Csbi.dwcursorposition.x 1;

Coord curhome = {0,0};

FillconsoleOutputcharacter (HNDL, '', N, CURHOME, & WRITTEN);

Csbi.srwindow.bottom - = csbi.srwindow.top;

Csbi.srwindow.top = 0;

SetConsoleWindowInfo (HNDL, TRUE, & CSBI.SRWINDOW);

SetConsolecursorPosition (HNDL, CURHOME);

Return 0;

}

The role is to clear the screen under the console

转载请注明原文地址:https://www.9cbs.com/read-124383.html

New Post(0)