[Gambas-user] Array for File class?

Tobias Boege taboege at ...626...
Fri Feb 1 12:44:17 CET 2013


On Thu, 31 Jan 2013, steveNewbie wrote:
> I tried the method below without success.  I am still getting "Class 'File'
> is not creatable" error.  I might have to resort to creating 50 separate
> File objects to get through this for now and clean up later.
> 
> Dim aFiles As New File[]
> Dim hFile As File
> Dim J As Integer
> 
> For J = 0 To 50
>         hFile = Open sPath For Read 
>         aFiles.Add(hFile)                    (For some reason, Add is not a
> method under this class!)
> Next 
> 

I tried the code before sending it. It worked - I read from the files I
created. Maybe your Gambas version is not recent enough?

Anyway, the Object[] class should at least work in such cases:

--8<---------------
Dim aFiles As New Object[]
Dim hFile As File
Dim J As Integer

For J = 0 To 50
	hFile = Open sPath For Read
	aFiles.Add(hFile)
Next
--8<---------------

Regards,
Tobi




More information about the User mailing list