Eluv
Eluv

Reputation: 59

Free Pascal IDE: Writeln and Readln don't work properly

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.

Upvotes: 3

Views: 1380

Answers (1)

Rudy Velthuis
Rudy Velthuis

Reputation: 28806

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.

Upvotes: 4

Related Questions