JJ
2019-07-21 21:14:59 UTC
With `ADODB.Stream` object, it's possible to create a byte array. i.e. an
actual array of bytes, instead of an array of variants of byte (`TypeName()`
is `Byte()`, instead of `Variant()`).
e.g. below code creates 100 bytes of a byte array.
set stream = createobject("adodb.stream")
stream.type = 2 'text type
stream.charset = "windows-1252"
stream.open
stream.writetext string(100, chr(0))
stream.position = 0
stream.type = 1 'binary type
array = stream.read 'the result
stream.close
However, because the array needs to be written in order to set its length,
it's slow for creating large array. So, is there a faster way to create a
byte array?
Also... What other COM objects can create an array of non variant types?
actual array of bytes, instead of an array of variants of byte (`TypeName()`
is `Byte()`, instead of `Variant()`).
e.g. below code creates 100 bytes of a byte array.
set stream = createobject("adodb.stream")
stream.type = 2 'text type
stream.charset = "windows-1252"
stream.open
stream.writetext string(100, chr(0))
stream.position = 0
stream.type = 1 'binary type
array = stream.read 'the result
stream.close
However, because the array needs to be written in order to set its length,
it's slow for creating large array. So, is there a faster way to create a
byte array?
Also... What other COM objects can create an array of non variant types?