From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,794a4cb8f6cfe39b X-Google-Attributes: gid103376,public From: kst@sd.aonix.com (Keith Thompson) Subject: Re: Clear Screen Date: 1997/02/28 Message-ID: #1/1 X-Deja-AN: 222026070 Sender: news@thomsoft.com (USENET News Admin @flash) X-Nntp-Posting-Host: pulsar References: <330FE569.29FA@bix.com> <5erk3a$a29@news.cict.fr> Organization: Aonix, San Diego, CA, USA Newsgroups: comp.lang.ada Originator: kst@pulsar Date: 1997-02-28T00:00:00+00:00 List-Id: In dewar@merv.cs.nyu.edu (Robert Dewar) writes: [...] > Clear_Screen : constant String := Ascii.ESC & "[2J"; On a more or less VT100-compatible terminal or emulator, the sequence ESC [ 2 J will clear the screen without moving the cursor. No problem if that's what you want, but you usually want to move the cursor to the upper left corner of the screen (window, whatever). > Put_Line (Clear_Screen); And, of course, this will move the cursor down one line after clearing the screen. This might be closer to what you want: Clear_Screen : constant String := Ascii.ESC & "[H" & Ascii.ESC & "[2J"; ... Put(Clear_Screen); If the lack of a newline causes buffering problems, you might consider writing to Standard_Error and/or calling Ada.Text_IO.Flush. If you're on a Unix system and you may be using a non-VT100-compatible terminal (unlikely these days), you might want to do something like this: with Interfaces.C; with Ada.Text_IO; procedure Clear_Screen is function System(S: String) return Interfaces.C.Int; pragma Import(C, System, "system"); Command : constant String := "clear" & Ascii.Nul; Result : Interfaces.C.Int; use type Interfaces.C.Int; begin Result := System(Command); if Result /= 0 then Ada.Text_IO.Put_Line ( Ada.Text_IO.Standard_Error, "clear failed, result = " & Interfaces.C.Int'Image(Result)); end if; end Clear_Screen; though it's likely to be inefficient. If you're using an Etch-A-Sketch (R) compatible display, you need to print a message asking the operator to turn it upside-down. -- Keith Thompson (The_Other_Keith) kst@sd.aonix.com <*> TeleSo^H^H^H^H^H^H Alsy^H^H^H^H Thomson Softw^H^H^H^H^H^H^H^H^H^H^H^H^H Aonix 10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2706 "Humor is such a subjective thing." -- Cartagia