netSurfer
Jan 21st, 2000, 02:45 AM
A friend had given me some code to go through a csv file and grab out a count of the number of fields as well as the actual info. It works but I have a question and he's not available at the moment.
I have the code to do this in a seperate function.
function ScanLine(iLine as string, strFields() as string) as integer
hte iLine is the entire line from the csv file. The strFields array is used to store the value and ScanLine returns a count of the number of fields. The function that calls it has a strFields() array declared as well. It seems that it runs this 2 times, 1 to get a count of fields, then ReDim's the strFields array with that number. Then it runs it again and this time it puts the value into the strFields array. I don't understand how 1 function can affect a variable in another function. Neither are globals or anything. They're just plain string declarations. If someone can shed some light on this I would appreciate it.
Thanks.
I have the code to do this in a seperate function.
function ScanLine(iLine as string, strFields() as string) as integer
hte iLine is the entire line from the csv file. The strFields array is used to store the value and ScanLine returns a count of the number of fields. The function that calls it has a strFields() array declared as well. It seems that it runs this 2 times, 1 to get a count of fields, then ReDim's the strFields array with that number. Then it runs it again and this time it puts the value into the strFields array. I don't understand how 1 function can affect a variable in another function. Neither are globals or anything. They're just plain string declarations. If someone can shed some light on this I would appreciate it.
Thanks.