No, you'll just get an array with only two values (when the separator only occurs once per line)
The value array(0) should be appended to the first array, and the value array(1) to the second.
I'll write some (pseudo-)code for your app, if you're interested
Assumptions:VB Code:
'Declaration of variables dim lenoffile as long dim buffer as string dim lines() as string dim numlines as long dim firstcolumn() as string dim secondcolumn() as string dim i as long 'Open textfile in binary mode. Why should you read line by line? This way saves you time, supposed that you have enough memory open "file.txt" for binary as #1 lenoffile = lof(1) 'Length of file buffer = space$(lenoffile) 'Make the buffer large enough get #1, , buffer 'Get the data into the buffer close #1 'you don't need it anymore lines = split(buffer, vbcrlf) 'Split the buffer into lines numlines = ubound(lines) + 1 'Determine the number of lines redim firstcolumn(numlines - 1) redim secondcolumn(numlines - 1) 'I've explained this part in my first post for i = 0 to numlines - 1 tempbuf = split(lines(i), vbtab) firstcolumn(i) = tempbuf(0) secondcolumn(i) = tempbuf(1) next i 'done!
*The lbound of arrays is 0 (hence the -1's every where)
*Firstcolumn and secondcolumn are the arrays where you wish to store the values.
*The textfile contains only data. Two values, separated by a tab, per line
Don't be scared by the binary opening of the file, and the get. I think this is just a much faster way than read a file in text mode line by line.
Good luck!
[edit]Added some comments[/edit]




Reply With Quote