[fpc-pascal] Writeln() behaves differently on Windows and Linux, why?
Michael Van Canneyt
michael at freepascal.org
Fri Jul 10 08:08:21 CEST 2020
On Fri, 10 Jul 2020, Bo Berglund via fpc-pascal wrote:
> On Fri, 10 Jul 2020 01:26:24 +0200, Tomas Hajny
> <XHajT03 at hajny.biz> wrote:
> Here I use the blocking Read(ch) instead and now Enter makes the code
> move on to the termination phase.
> It will not be used at all in the production program...
>
> But I really asked about the *difference* between Windows and Linux
> behaviour because on Windows the original code works fine without any
> screen mess.
The crt unit has been in use for 25 years. It behaves as expected.
However, times change, terminals too, so who knows.
Before answering to you I wrote a small program that does what you do.
Write to screen, wait for keypress. Write again to screen.
It behaves as expected: the next line is written flushed-left.
The only difference with your program is that mine does not use threads
which also write to screen.
So the hypothesis that it is the threads that are messing up the terminal.
It can also be that Indy messes up the terminal but I consider this less
likely.
Michael.
More information about the fpc-pascal
mailing list