2
votes

Using the Free Pascal IDE, I have some problems with console IO under Windows.

When I use Writeln the cursor doesn't move to the next line and is staying at the end of the written line. So if I press Enter instead of moving to the next line the cursor goes to the beginning of the current line. And if I use Readln after Writeln new characters that I enter are displayed instead of the characters that were written with Writeln.

When I use Readln to enter string I have next problem. If I enter some string, use backspace to delete characters and enter other characters after that, Readln return to program string that includes backspace symbols and deleted characters.

I guess this is Windows problem, but I have no ideas.

1
How can this be reproduced? - David Heffernan
@David: Start any console program with the FPC IDE (the simple on that comes with FPC and looks a little like Turbo Pascal) on Windows 10. - Rudy Velthuis
@Rudy Could you edit the question please, because then there is value - David Heffernan

1 Answers

3
votes

It looks as if you have run into a (known) problem with the Free Pascal IDE on Windows 10. This happens to console programs started from that IDE. There is no fix, and no workaround (well, there is one: use unit Crt). It has other issues as well.

Just try another IDE, e.g. Lazarus.

Note that your program will run fine if started standalone. But not when started from the FPC IDE.