<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255); text-align: left;" dir="auto">
perhaps try 'reset' or 'stty sane' in the terminal before running your program?</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255); text-align: left;" dir="auto">
<br>
</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255); text-align: left;" dir="auto">
are you using the crt or video units at all?</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255); text-align: left;" dir="auto">
<br>
</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255); text-align: left;" dir="auto">
it sounds like your terminal has gotten fudged somehow</div>
<div id="ms-outlook-mobile-signature">
<div><br>
</div>
--<br>
Alexander Grotewohl<br>
<a href="https://dcclost.com" target="_blank">https://dcclost.com</a></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> fpc-pascal <fpc-pascal-bounces@lists.freepascal.org> on behalf of Bo Berglund via fpc-pascal <fpc-pascal@lists.freepascal.org><br>
<b>Sent:</b> Thursday, July 9, 2020 12:01:42 PM<br>
<b>To:</b> fpc-pascal@lists.freepascal.org <fpc-pascal@lists.freepascal.org><br>
<b>Cc:</b> Bo Berglund <bo.berglund@gmail.com><br>
<b>Subject:</b> [fpc-pascal] Writeln() behaves differently on Windows and Linux, why?</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">I am writing a cross-platform program (console program, no GUI).<br>
I am using Lazarus 2.0.8 and FPC 3.0.4 on both Linux and Windows.<br>
<br>
During sebugging I have put numerous writeln commands in the code to<br>
track what is happening.<br>
I started on Windows and all worked just fine according to<br>
expectations.<br>
Every new output generated a new line on the console with the printed<br>
text left aligned.<br>
<br>
But then I moved the code over to Linux (Raspbian Buster) and<br>
strangely this happens:<br>
<br>
Test line 1<br>
Test line 2<br>
Test line 3<br>
<br>
and so on.<br>
It looks exactly the same if I use a terminal window on the Linux<br>
system itself as it does if I connect to the Linux machine using PuTTY<br>
from Windows...<br>
<br>
<br>
It seems like a writeln() in the code does actually not do a carriage<br>
return on the console, just a linefeed so the console continues at the<br>
column where the previous line ended.<br>
The messages I print out are simple text strings either showing<br>
incoming data packets or just my comment.<br>
<br>
Typical code:<br>
<br>
s := 'Status changed: ' + newstat + ' msg: ' + AStatusText;<br>
LogStd(s);<br>
Writeln(s);<br>
<br>
In the log file this obviously does not happen...<br>
<br>
What can cause this strange behaviour?<br>
<br>
<br>
-- <br>
Bo Berglund<br>
Developer in Sweden<br>
<br>
_______________________________________________<br>
fpc-pascal maillist - fpc-pascal@lists.freepascal.org<br>
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br>
</div>
</span></font></div>
</body>
</html>