VAR T : Text; NumLines : LongInt; Begin Assign(T,'MyFile.Txt'); Reset(T); While Not Eof(T) Do Begin ReadLn(T); Inc(NumLines); End; Close(T); End.