D Program code on CLS

nazriel spam at dzfl.pl
Thu Nov 14 05:48:38 PST 2013


On Thursday, 14 November 2013 at 03:35:59 UTC, Vincent 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 mean something like that:

---

import std.stdio;
import core.thread;

void main() {
     foreach (i; 0..10) {
         write("\r", i);
         stdout.flush();
         Thread.sleep(250.msecs);

     }

}

---

If yes, you want to play with carriage return and flushing 
terminal.


More information about the Digitalmars-d-learn mailing list