Syntax 2: For character arrays or blobs
Description
Reads data from an OLE stream object into a character array or
blob.
Applies to
OLEStream objects
Syntax
|
1 |
olestream.Read ( variable {, maximumread } ) |
|
Argument |
Description |
|---|---|
|
olestream |
The name of an OLE stream variable that has been |
|
variable |
The name of a blob variable or character array into |
|
maximumread (optional) |
A long value specifying the maximum number of bytes to |
Return value
Integer. Returns 0 if it succeeds and one of the following
negative values if an error occurs:
-1 — Stream is not open
-2 — Read error
-9 — Other error
If any argument’s value is null, Read returns null.
Examples
This example opens an OLE object in the file MYSTUFF.OLE and
assigns it to the OLEStorage object stg_stuff. Then it opens the stream
called info in stg_stuff and assigns it to the stream object
olestr_info. Finally, it reads the contents of olestr_info into the blob
lb_info.
The example does not check the functions’ return values for
success, but you should be sure to check the return values in your
code:
|
1 2 3 4 5 6 7 8 9 10 11 |
boolean lb_memexists OLEStorage stg_stuff OLEStream olestr_info blob lb_info stg_stuff = CREATE OLEStorage stg_stuff.Open("c:ole2mystuff.ole") olestr_info.Open(stg_stuff, "info", & stgRead!, stgExclusive!) olestr_info.Read(lb_info) |
See also