Hi,
Is there any funtion available to find no. of lines in a text file. i opened up a text file and set TEXTMODE(True), now how can i find no. of lines in that file (dont want to use LEN function but want to know the end of text file).
thanks in advance
0
Comments
1. No. of lines in a text-file
As stated in the online help is TEXTMODE only to open the file as a text-file. E.g. so you can READ with a Text-variable.
There is - AFSIK - no way of knowning the number of lines in the file upfront.
2. If a file is in use ?
The only way I'm aware of, is to copy/rename the file.
If that succeeds, the file is yours.
You can use the RENAME/COPY file commands (check F5 - CA/L Symbol Menu under FILE).
Hope this will help you. May I ask to what you need this ?
Thoms Hviid Thorn
Thank you so much. anyway i manage to get what i really want.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I have to read till the end of the file. How do I find that out?
I was trying to check CharCount returned by READ method and stopping when it's zero.The problem with this approach is that if the file has an empty line then the code thinks that the file has ended and does not read all the lines after that.
count := file.read(line);
while count > 0 do
begin
....
.....
count := file.read(line);
end;