Structured one dimension Array

Discussion in 'Questions (Windows Mobile)' started by Cableguy, Jun 27, 2007.

  1. Cableguy

    Cableguy Expert Licensed User

    Hi

    I'm reading data from a file(ini) wich as the follwing data:

    peaches-20
    aples-15
    bananas12

    I defined an array like this:

    Dim Type(Fruit,Quantity) Basket(3)

    Now I whant to populate the array with the data read from the file
    Since this is a finite and short list I am reading line-by-line, but how do I populate the array?

    I tryed this
    r=FileRead(c1)
    Basket(0)=StrSplit(r,"-")

    But it return an error message saying that basket is not a one dimension array...

    Help?!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can't do it directly. (It will be supported in the next version)
    For now you will need something like:

    Sub Globals
    Dim Type(Fruit,Quantity) Basket(3)
    Dim Type(Fruit,Quantity) Temp
    End Sub

    For i = 0 to 2
    r = FileRead(c1)
    Temp() = StrSplit(r,"-")
    Basket(i).Fruit = Temp.Fruit
    Basket(i).Quantity = Temp.Quantity
    Next
     
Loading...