[Gambas-user] Read and arrays

tobi tobiasboege01 at ...1601...
Mon Mar 12 17:21:04 CET 2012


On Mon, 12 Mar 2012, Jussi Lahtinen wrote:

> I was thinking quicker way to read large binary files to memory.
> And I noticed this; "The returned datatype can be one of the following:
> NULL, Boolean, Byte, Short, Integer, Long, Pointer, Single, Float, Date,
> String, Variant, any Array, Collection or structure".
> http://gambasdoc.org/help/lang/read?v3
> 
> So, I wonder whether it is quicker to read data as array, instead of
> looping one (short) integer at time.
> 
> But how to do that? Did I misunderstand something?
> 
> 
> tmpArr = Read hFile As Short[2000]
> 
> Doesn't compile (unexpected '[')... or does this work only for data written
> as array, and read as Short[] without given bounds?
> 
> 
> Jussi
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

i once watched the format of files to which arrays/collections were written. they consist, if i
remember correctly, of an identifier followed by the size and then the data.
if you write an array to a file you can only read that array back, i think.
so it works on datatype base, not on raw memory base if you Read As Datatype. reading as much as
possible in one call is definitely faster (that is the reason for which the standard libc streams are
buffered by default). reading raw memory arrays of fixed size may be done using memory streams...?
do they persist in gambas3? i can't check anything now.

regards,
tobi




More information about the User mailing list