1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| #ifdef _Windows
#include <windows.h>
#elif defined(linux) /* ou autres Unix qui possèdent NCurses */
#include <ncurses.h>
#define UTILISE_NCURSES
#elif defined(__MSDOS__)
#include <dos.h>
#endif
/* Efface l'écran texte et se positionne le curseur en haut à gauche */
void EffaceEcranTxt(void)
{
#if defined(UTILISE_NCURSES)
clear();
move (0,0);
#elif defined(_Windows)
/* Début : (1,1) */
CONSOLE_SCREEN_BUFFER_INFO Info;
COORD Debut;
DWORD NbrOctetEcrit;
Debut.X = 0;
Debut.Y = 0;
/* Lit les infos sur le buffer */
GetConsoleScreenBufferInfo (HdlConsole, &Info);
/* Remplit l'écran avec le caractère espace : ' ' */
FillConsoleOutputCharacter (HdlConsole, ' ', Info.dwSize.X*Info.dwSize.Y, Debut, &NbrOctetEcrit);
/* Positionne le curseur */
SetConsoleCursorPosition (HdlConsole,Debut);
#elif defined(__MSDOS__)
union REGS inregs, outregs;
struct SREGS segregs;
inregs.h.ah = 0x00; /* Fonction 00h : Change de mode video */
inregs.h.ah = 0x03; /* Mode = 03h : 80x25 caracteres, 16 couleurs */
int86x(0x10, &inregs, &outregs, &segregs); /* Interruption 10h : Video */
#endif
} |
Partager