Pascal - 清算终端

Pascal - Clearing terminal

从这里开始使用 Pascal。我想写一个简单的程序,首先清除终端window,然后读取用户输入。搜索清屏的第一个结果显示ClrScr程序。使用它可以完成工作,但 ClrScr 需要 Crt,这会导致新问题。使用 Ctrl + C 终止程序不起作用。再次上网搜索,发现Crt接管了I/O。我一直在寻找 ClrScr 的替代品,但到目前为止还没有真正找到任何东西。

So how can I clear terminal while still being able to terminate the program using Ctrl + C. Also how can I terminate the program in the current case using Crt?

当前代码:

    program Test;
    uses Crt;
    var     
            x : integer;
    begin
            read(x);
    end.

到目前为止,我在网上看到的解决方案以及评论中建议保留CRT的解决方案只会使它变得麻烦并且不必要地使程序变得复杂。所以现在我决定完全放弃它。

我现在找到的解决方法是将 unix.fpsystemclear 命令一起使用,这样就可以很好地完成工作。