ProductOfMomAndDad Posted February 25, 2006 Share Posted February 25, 2006 Hi there! Can someone tell me how i can read values from a file into a 2 dimensional array? I have a text file with records like: 12, 50, 676, 2323 123,453,6756,86 344,4545,6666,5 With _FileCountLines i can determine the number of records and store it in e.g. $totalRecords. That works fine. Now i'd like to read the values into an array. Something with $recordsArray[$totalRecords][4] But when i use _FileReadToArray and then use MsgBox(0,"",$recordsArray[1][1]) i get an error message about wrong subscripts and the program terminates. When i use MsgBox(0,"",$recordsArray[1]) i get as output: 12,50,676,2323 meaning the whole record has been read into one variable instead of in the four variables [1][1] and [1][2] and [1][3] and [1][4] Hope someone can help me. Bye all! I am not real smart, but i can lift heavy things... Link to comment Share on other sites More sharing options...
GaryFrost Posted February 25, 2006 Share Posted February 25, 2006 Hi there! Can someone tell me how i can read values from a file into a 2 dimensional array? I have a text file with records like: 12, 50, 676, 2323 123,453,6756,86 344,4545,6666,5 With _FileCountLines i can determine the number of records and store it in e.g. $totalRecords. That works fine. Now i'd like to read the values into an array. Something with $recordsArray[$totalRecords][4] But when i use _FileReadToArray and then use MsgBox(0,"",$recordsArray[1][1]) i get an error message about wrong subscripts and the program terminates. When i use MsgBox(0,"",$recordsArray[1]) i get as output: 12,50,676,2323 meaning the whole record has been read into one variable instead of in the four variables [1][1] and [1][2] and [1][3] and [1][4] Hope someone can help me. Bye all! I am not real smart, but i can lift heavy things... you'll have to stringsplit on the comma to seperate the values SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
ProductOfMomAndDad Posted February 25, 2006 Author Share Posted February 25, 2006 you'll have to stringsplit on the comma to seperate the valuesThat's FAST!Thank you for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now