Thread overview
Clear screen
Aug 26, 2001
qwertier9023
Aug 26, 2001
Walter
Oct 29, 2001
Kenneth Roger
Oct 29, 2001
Jan Knepper
Oct 30, 2001
Roland
Oct 31, 2001
Walter
Oct 30, 2001
Kenneth Roger
Nov 13, 2013
Vincent
Nov 21, 2013
Heinz Saathoff
August 26, 2001
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


August 26, 2001
#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
>
>


October 29, 2001
> --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);
  }



October 29, 2001
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);
>   }

October 30, 2001
> --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);
  }



October 30, 2001
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


October 31, 2001
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);
>   }
>
>
>


November 13, 2013
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...
November 21, 2013
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