Re: [Gambas-user] Read and arrays
OK, I didn't notice that... Thanks! Jussi 2012/3/13 Benoît Minisini > Le 12/03/2012 17:21, tobi a écrit : > > 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 > > > > 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 > > > > Arrays have Read() and Write() methods to read/write their contents > from/to the disk. > > Regards, > > -- > Benoît Minisini > > > -- > 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@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > -- Keep Your Developer Skills Current with LearnDevNow! 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-d2d ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Read and arrays
Le 12/03/2012 17:21, tobi a écrit : > 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 > > 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 > Arrays have Read() and Write() methods to read/write their contents from/to the disk. Regards, -- Benoît Minisini -- 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Read and arrays
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@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 -- 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Read and arrays
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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user