[fpc-pascal] Writeln() behaves differently on Windows and Linux, why?
Rainer Stratmann
rainerstratmann at t-online.de
Thu Jul 9 21:13:38 CEST 2020
I had exactly the same behaviour.
Some setterm commands solved it, if I remember correct.
setterm -blank 0
setterm -powersave off
I guess it was the first command.
You can try it.
Am Donnerstag, 9. Juli 2020, 18:01:42 CEST schrieb Bo Berglund via fpc-pascal:
> I am writing a cross-platform program (console program, no GUI).
> I am using Lazarus 2.0.8 and FPC 3.0.4 on both Linux and Windows.
>
> During sebugging I have put numerous writeln commands in the code to
> track what is happening.
> I started on Windows and all worked just fine according to
> expectations.
> Every new output generated a new line on the console with the printed
> text left aligned.
>
> But then I moved the code over to Linux (Raspbian Buster) and
> strangely this happens:
>
> Test line 1
> Test line 2
> Test line 3
>
> and so on.
> It looks exactly the same if I use a terminal window on the Linux
> system itself as it does if I connect to the Linux machine using PuTTY
> from Windows...
>
>
> It seems like a writeln() in the code does actually not do a carriage
> return on the console, just a linefeed so the console continues at the
> column where the previous line ended.
> The messages I print out are simple text strings either showing
> incoming data packets or just my comment.
>
> Typical code:
>
> s := 'Status changed: ' + newstat + ' msg: ' + AStatusText;
> LogStd(s);
> Writeln(s);
>
> In the log file this obviously does not happen...
>
> What can cause this strange behaviour?
More information about the fpc-pascal
mailing list