Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

doubt in clrscr

Status
Not open for further replies.
Dec 9, 2002
13
IN
Hai friends,
Iam using Turbo Pascal 7.0.

In this simple program:

program test(input,output);
begin
clrscr;
writeln;
Writeln('Hello');
Readln;
end.

Here, in this program in line 3 (ie) clrscr;

Its giving an error saying unknown identifier.

I want to clear the screen and show the output.

Kindly advice me as regards this.

Regards
Uma.
 
clrscr is declared in the crt unit.

try this:
[tt]
program test(input,output);
uses crt; { <- add this line }
begin
clrscr;
writeln;
Writeln('Hello');
Readln;
end.
[/tt]
 
Hai,
Thanx for ur reply. But I have added uses Crt in the program

(ie)
program test(input,output);
uses Crt;
begin
clrscr;
writeln;
Writeln('Hello');
Readln;
end.


But its giving a runtime error as Division by zero for this. Plz help me as Iam desperate.
 
Yes, this is a well known fault in turbo pascal. The reason is that you are using a fast computer. One of the functions of the crt unit is to do some timing, and for this it begins by establishing the speed of your computer by counting up from zero while it times something. If the machine is very fast, the count never gets beyond zero, and crt causes a division-by-zero error before the program even starts to run.

But all is not lost! Because this is well known, there are already a lot of replacement crt units and patches written by friendly lovers of Pascal. Do some web-searching and you'll find one.

I've never bothered because I only use crt for keypress functions, so when i found out about that error I just wrote my own call-to-dos for keypresses, and haven't used crt since.

Hope this helps,

Lionel

(Oh, and compliments to Borland, it's a very rare thing to find a bug in their compilers)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top