Syntax 1 For reading into a string
Description
Reads data from an OLE stream object into a string.
Controls
OLEStream objects
Syntax
1 |
<span>olestream</span>.<span>Read</span> ( <span>variable</span> {, <span>stopforline</span> } ) |
Argument |
Description |
---|---|
olestream |
The name of an OLE stream variable that |
variable |
The name of a string variable into which |
stopforline (optional) |
A boolean value that specifies whether
|
Return Values
Integer. Returns the number of characters
or bytes read. If an end-of-file mark (EOF) is encountered before
any characters are read, Read returns -100. Read returns
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 string ls_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 |
boolean lb_memexists |
1 |
OLEStorage stg_stuff |
1 |
OLEStream olestr_info |
1 |
blob ls_info |
1 |
1 |
stg_stuff = CREATE OLEStorage |
1 |
stg_stuff.Open("c:ole2mystuff.ole") |
1 |
1 |
olestr_info.Open(stg_stuff, "info", & |
1 |
stgRead!, stgExclusive!) |
1 |
olestr_info.<span>Read</span>(ls_info) |