[Gambas-user] Pass array to a Function or Sub.

Leo Barnhoorn leo.barnhoorn at ...246...
Sun Oct 31 02:41:01 CET 2004


Hello Benoit,

I like to pass a array to a function or sub but it is not working any more.

Below a example :

The ByteArray is empty when i pass it to this function, except the first 
element of the array.

PRIVATE FUNCTION ByteToBit(ByteArray AS Byte[]) AS String
Array is empty. except first element.
END

This is the way i make the ByteArray.

PRIVATE FUNCTION ReadHeader(sFileName AS String) AS Boolean
   DIM ByteArray  AS NEW Byte[]

   ByteArray.Resize(4)


Filling the array.

   SEEK #hFile, HeadStart
   FOR z = 0 TO 3
      READ #hFile, Bytes
      ByteArray[z] = Bytes
   NEXT

 At this point the array is filled. Insite the function the array is empty 
except the first element of the array.

   sBin = ByteToBit(ByteArray)
END

Regards,
Leo.





More information about the User mailing list