Getting started with Pascal here. I wanted to write a simple program that first clears the terminal window and then reads user input. The first result of searching for clearing the screen showed the ClrScr
procedure. Using it gets the job done but ClrScr
needs Crt
which results in a new problem. Terminating the program using Ctrl + C
does not work. Searching online again, I found that Crt
takes over I/O. I have been looking for alternative to ClrScr
but haven't really found anything so far.
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 usingCrt
?
Current Code:
program Test;
uses Crt;
var
x : integer;
begin
read(x);
end.