www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - Clear screen

reply "qwertier9023" <psonetwol hotmail.com> writes:
hi
I've noticed that other dos and win compilers have conio.h that contains
code for clear screen. _clrscr What is the equivalent for Digital Mars?
Thanks in advance
Aug 26 2001
next sibling parent "Walter" <walter digitalmars.com> writes:
#include <disp.h>

disp_move(0,0);
disp_eeop();

qwertier9023 wrote in message <9ma8nu$oc7$1 digitaldaemon.com>...
hi
I've noticed that other dos and win compilers have conio.h that contains
code for clear screen. _clrscr What is the equivalent for Digital Mars?
Thanks in advance
Aug 26 2001
prev sibling next sibling parent reply "Kenneth Roger" <kennethroger prodigy.net> writes:
 --code for clear screen. _clrscr What is the equivalent for Digital Mars?
#include <dos.h> void clrscr() { union REGS reg; reg.x.ax=0x0600; reg.h.bh=7; reg.x.cx=0; reg.x.dx=0x184F; int86(0x10,&reg,&reg); reg.h.ah=0x2; reg.x.dx=0; reg.h.bh=0; int86(0x10,&reg,&reg); }
Oct 29 2001
next sibling parent Jan Knepper <jan smartsoft.cc> writes:
You could rewrite this with
int86x/int86x_real and using REGS, REGS and SREGS...
Check bios.h and dos.h

Jan



Kenneth Roger wrote:

 --code for clear screen. _clrscr What is the equivalent for Digital Mars?
#include <dos.h> void clrscr() { union REGS reg; reg.x.ax=0x0600; reg.h.bh=7; reg.x.cx=0; reg.x.dx=0x184F; int86(0x10,&reg,&reg); reg.h.ah=0x2; reg.x.dx=0; reg.h.bh=0; int86(0x10,&reg,&reg); }
Oct 29 2001
prev sibling next sibling parent Roland <rv ronetech.com> writes:
Kenneth Roger a écrit :

 --code for clear screen. _clrscr What is the equivalent for Digital Mars?
#include <dos.h> void clrscr() { union REGS reg; reg.x.ax=0x0600; reg.h.bh=7; reg.x.cx=0; reg.x.dx=0x184F; int86(0x10,&reg,&reg); reg.h.ah=0x2; reg.x.dx=0; reg.h.bh=0; int86(0x10,&reg,&reg); }
doesn't it work like that ? may be you just have to replace int86 by int86_real Roland
Oct 30 2001
prev sibling parent "Walter" <walter digitalmars.com> writes:
www.digitalmars.com/faq.html#clrscr

"Kenneth Roger" <kennethroger prodigy.net> wrote in message
news:9rk756$r8h$1 digitaldaemon.com...
 --code for clear screen. _clrscr What is the equivalent for Digital
Mars?
 #include <dos.h>
 void clrscr()
   {
   union REGS reg;
   reg.x.ax=0x0600;
   reg.h.bh=7;
   reg.x.cx=0;
   reg.x.dx=0x184F;
   int86(0x10,&reg,&reg);
   reg.h.ah=0x2;
   reg.x.dx=0;
   reg.h.bh=0;
   int86(0x10,&reg,&reg);
   }
Oct 30 2001
prev sibling next sibling parent "Kenneth Roger" <kennethroger prodigy.net> writes:
 --clear screen. _clrscr What is the equivalent for Digital Mars?
The console window peepers can do it this way. #include <windows.h> void clrscr() { HANDLE hout; DWORD nc, ncw; CONSOLE_SCREEN_BUFFER_INFO sbi; COORD home; home.X=home.Y=0; hout=GetStdHandle(STD_OUTPUT_HANDLE); if(hout==INVALID_HANDLE_VALUE) return; GetConsoleScreenBufferInfo(hout,&sbi); nc=sbi.dwSize.X*sbi.dwSize.Y; FillConsoleOutputAttribute(hout,sbi.wAttributes,nc,home,&ncw); FillConsoleOutputCharacter(hout,' ',nc,home,&ncw); SetConsoleCursorPosition(hout,home); }
Oct 29 2001
prev sibling parent reply "Vincent" <spawn_rock2000 yahoo.com> writes:
how can I clear the screen for example I input first letter (A) 
and second letter (B) and show the result AB then after pressing 
enter it will clear the screen before it display again the Input 
first letter


Input first letter : A
Input second letter: B
result: AB
Input first letter: _

it should not be displaying the previous output like this... 
After showing the result it should be cleared the previous output 
before it shows the input first letter again...
Nov 13 2013
parent Heinz Saathoff <newshsaat arcor.de> writes:
Hello,

On Wed, 13 Nov 2013 19:05:50 +0100, "Vincent"
<spawn_rock2000 yahoo.com> wrote:

how can I clear the screen for example I input first letter (A) 
and second letter (B) and show the result AB then after pressing 
enter it will clear the screen before it display again the Input 
first letter


Input first letter : A
Input second letter: B
result: AB
Input first letter: _

it should not be displaying the previous output like this... 
After showing the result it should be cleared the previous output 
before it shows the input first letter again...
You can use the display routines as declared in DISP.H The code can be like this: #include <disp.h> #include <conio.h> int main() { char a, b; disp_open(); // Init package do { disp_move(0,0); // top of screen disp_eeop(); // erase to end of page disp_puts("Input first letter :"); disp_flush(); a = _getche(); // read char with echo disp_puts("\nInput second letter :"); disp_flush(); b = _getche(); disp_printf("\nresult: %c%c\n", a, b); disp_puts("Press any key to repeat"); disp_flush(); _getch(); // wait so that result can be seen }while(a != ' '); disp_close(); return 0; }//main - Heinz
Nov 21 2013