i realize i can use Xsplit to read a file into an array (txt file), my question is how would i autoset the array size depending on how many lines on file?
say i have only 10 lines on file how would i have it detect the end of the file so that it will also return a number (the last line)
say for example my array name is ZDC and the var for the last line is EndFileNum
for i := 1 to EndFileNum Do
how would i set EndFileNum without actually coding in the number of lines on file?
edit: title made more appropriate
edit2: would this work:
function GetFileLineNum(file:array of string):integer;
var LineNum,i:Integer;
begin
file:= xsplit(readfile(file),chr(13)+chr(10));
LineNum:=1;
for i:= 1 to LineNum do begin
if file[i] <> "" then begin
LineNum:= LineNum+1;
repeat;
else
Result := LineNum;
end;
end;