[Gambas-user] Re: save and load an array of MydataType
Toni Schornboeck
lists at ...706...
Fri Jan 7 12:26:43 CET 2005
Jochen Georges writes:
> Thanks, but still i do not have an idea how i can load this array from a file
> if i do not know how many items it contains.
Haven't used such code yet, but what about:
i AS Integer
myFile AS File
newCars AS Object[]
tmpcar AS CCar
newCars = NEW Object[]
tmpcar = NEW CCar
IF Dialog.OpenFile() THEN RETURN
TRY OPEN dialog.Path FOR READ AS myFile
WHILE NOT EOF(myFile)
tmpcar=new CCar
tmpcar.ReadFrom(myFile)
newCars.Add(tmpcar)
NEXT
CLOSE myFile
or just store the number of objects as the first line of the file ;)
More information about the User
mailing list