[fpc-pascal] Writeln() behaves differently on Windows and Linux, why?

Bo Berglund bo.berglund at gmail.com
Fri Jul 10 00:40:38 CEST 2020


On Thu, 09 Jul 2020 23:11:34 +0200, Tomas Hajny
<XHajT03 at hajny.biz> wrote:

>You can use the unit Keyboard as well, which is cross-platform.

I did as follows:

uses
  ...
  Keyboard,
  ...
begin
  ...
    repeat
      //ch := ReadKey; //ReadKey is not supported by Keyboard...
      Read(ch);
    until ch='q'; {q}
  ...
end.

Now what happened is that the display is back to normal without these
missing carriage returns.

But I also must hit Enter after using the q key in order for the loop
to break.

So Crt was the culprit for the messed up Writeln() output, but
replacing it with Keyboard brought back the old keyboard read
behaviour.

Removing Keyboard and Crt from uses does not change anything, but the
display now is sensible at least. So Keyboard is not needed it seems.
At least it does not add anything in this program.

So I will have to live with q<Enter> to break the loop...


-- 
Bo Berglund
Developer in Sweden



More information about the fpc-pascal mailing list