[Gambas-user] save and load an array of MydataType

Jochen Georges jochengeorges at ...467...
Fri Jan 7 02:07:21 CET 2005


On Thursday 06 January 2005 16:19, Benoit Minisini wrote:
> On Thursday 06 January 2005 12:59, Jochen Georges wrote:
> > Hello gambanauts,

> FOR i = 0 TO arCars.Count - 1
>   arCars[i].writeTo(myFile)
> NEXT
>
> should behave correctly.

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.

 i AS Integer
    myFile AS File
    newCars AS Object[]
    tmpcar AS CCar
    newCars = NEW Object[]
    FOR i = 0 TO cnt // if i do not know cnt ...
        tmpcar = NEW CCar
        newCars.add(tmpcar)
    NEXT
    IF Dialog.OpenFile() THEN RETURN
        TRY OPEN dialog.Path FOR READ AS myFile
            FOR i = 0 TO cnt
                newCars[i].ReadFrom(myFile)
            NEXT
        CLOSE myFile


> Why ?? Can you rollback these changes, so that functions and instructions
> keep separate ?

I took it back.

> Or we can mix them all. But there must be some logic...

I would appreciate this.
I think it is easier to have it in one sight.
Maybe like this
<h1>File Management</h1>
<h2>Keywords</h2>
 COPY
 KILL
 LINK
<h2>Functions</h2>
 Access
 Dir
 Exist



Beste Gruesse
Jochen






More information about the User mailing list