[comp.lang.pascal] cls for pascal?

donp@tekfdi.TEK.COM (03/12/87)

Can someone tell me how to clear the screen from inside a pascal
program. I just started programing in pascal and my text doesn't
have a command for it. 

Can't stand a messy screen.

Thanks
Don

mturtle%UMASS.BITNET@wiscvm.wisc.EDU (03/12/87)

Someone recently posted a question asking how to clear the screen from inside a
Pascal program.  Answer: it depends.  What kind of computer are you using?  Are
you using a terminal hooked up to a larger machine or are you using a personal
computer?  What kind of terminal or personal computer?  If you'll post answers
to these questions I'll be more than happy to try to answer your question, but
the answer is definitly machine specific.
    Except.  Except that you could probably get away with a little loop
like this:

For Loop := 1 to 24 do  (*  Note that this assumes that there are 24 lines on *)
    WriteLn;            (*  the screen you want to clear.                     *)

    Strictly speaking, this won't do the same thing that cls does in most
BASICs, since it (probably) won't home the cursor.  But it will clear the mess
off of your screen.

    Good luck,

    Peter

samlb@well.uucp (03/12/87)

In article <825@tekfdi.TEK.COM> donp@tekfdi.UUCP (Don Primrose) writes:
>... tell me how to clear the screen from inside a pascal program?

	That very much depends on which Pascal you are using, and what kind of
terminal you have.  Turbo Pascal has a ClrScr command, which takes care of it
if you have defined your setup right.
	Other Pascals rely on sending a series of ASCII bytes to the screen
which will cause it to clear.  For example, Soroc, Televideo, and Liberty
terminals clear the screen to all blanks and Home the cursor when they get
an "<Esc>*" sequence.  To send this from Pascal, you would code in:

	WriteLn(CHR(27),'*');

(Capitalization optional) in your program whenever you wanted to clear the
screen -- although I'd recommend putting:

	Procedure CLS;
	Begin
	  WriteLn(Chr(27),'*');
	End (* CLS *);

somewhere near the beginning of the program (so you can find and 
change it easily if you switch machines or terminals), and calling it 
when you need it.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sam'l Bassett, Self-Employed Writer -- My words & ideas are my own!
34 Oakland Ave., San Anselmo  CA  94960;
DDD:         (415) 454-7282;     /  dual\
UUCP:        {...known world...}! lll-crg!well!samlb;
Compuserve:  71735,1776;         \hplabs/

jsgray@watrose.UUCP (03/14/87)

Look up the "page" procedure.  With no arguments (i.e. writing to the
"output" file), it just might clear the screen!

Jan Gray    jsgray@watrose    University of Waterloo    (519) 885-1211 x3870