[fpc-pascal] Writeln() behaves differently on Windows and Linux, why?
Bo Berglund
bo.berglund at gmail.com
Thu Jul 9 22:55:18 CEST 2020
On Thu, 9 Jul 2020 19:36:31 +0200 (CEST), Michael Van Canneyt
<michael at freepascal.org> wrote:
>Is this done in a thread ? Since you're using indy, I suppose so.
>
>The crt unit is not thread safe. The implementation on Windows and Linux is
>totally different, which may explain the difference you see.
Is there a way to check user keyboard input in the main program while
action is being done in the server's threads?
The code I first tried did not need to use crt:
repeat
Read(ch);
until (ch='q');
But it acts like Readln(), in that it requires the user to press 'q'
followed by ENTER in order for the loop to break.
Then I used this but it needs the crt unit:
repeat
ch := ReadKey;
until ch='q'; {q}
and now the user just needs to hit q without any follow-up ENTER.
--
Bo Berglund
Developer in Sweden
More information about the fpc-pascal
mailing list