[Lazarus] How to clear screen in console app

Bo Berglund bo.berglund at gmail.com
Sat Apr 23 07:32:55 CEST 2016


I need to make a console app that can run on Linux.
It would be a simple thing I believed, but no...

I cannot get the ClrScr command working, it just puts strange
characters on the screen instead of clearing it.
I started with a Console app in Lazarus and just added this piece of
code:
  { add your program here }
  repeat
    ClrScr;  //Needs Crt in uses
    Write('Enter command: ');
    Readln(FCheck);
  until FCheck = 'q';

But the console debug window just shows a bunch of control characters
(square with 001B inside) plus [6n [H [m [H [2JEnter command:
And every command I enter results in a new line being displayed rather
than staying on the same line and erasing the previous output.

What am I doing wrong?

-- 
Bo Berglund
Developer in Sweden





More information about the Lazarus mailing list