|
Thanks guys! From your hints and suggestions, I rewrote the readFile to the following readCSV (it now returns a ready to use array of servers, their ip and servergroup:) ) :
[CODE] ;adapted CMReadfile() by Cristophe Melin Function readCSV($file) Dim $handle $handle=freefilehandle $=open($handle,$file) if @error exit @error endif redim $readfile[1024] dim $nb $nb=-1 do $nb = $nb + 1 if $nb>UBound($readfile) redim preserve $readfile[UBound($readfile)*2] endif $readfile[$nb]=readline($handle) until @error $=close($handle) if $nb=1 exit 1024 else redim preserve $readfile[$nb-1] endif reDim $readCSV[Ubound($readfile),2] $i = 0 For Each $row In $readfile ;logLine("Linje $i: $row") $temp = split($row,";") $readCSV[$i,0] = $temp[0] $readCSV[$i,1] = $temp[1] $readCSV[$i,2] = $temp[2] $i = $i + 1 Next EndFunction [/CODE]
I'm not so sure of what you meant with that check tho Christophe. Your suggesting a check as to wherther the row is "splitable"?
|