Syntax 1 For OLE stream objects
Description
Moves the read/write pointer to the specified position
in an OLE stream object. The pointer is the position in the stream
at which the next read or write begins.
Controls
OLEStream objects
Syntax
1 |
<span>olestream</span>.<span>Seek</span> ( <span>position</span> {, <span>origin</span> } ) |
Argument |
Description |
---|---|
olestream |
The name of an OLE stream variable that |
position |
A long whose value is the position relative |
origin (optional) |
The value of the SeekType enumerated
|
Return Values
Integer. Returns 0 if it succeeds and
one of the following negative values if an error occurs:
-
-1 Stream is not open
-
-2 Seek error
-
-9 Other error
If any argument’s value is null, Seek returns null.
Examples
This example writes additional data to an OLE stream.
First, it 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. Seek positions
the read/write pointer at the end of the stream so that
the contents of the instance blob variable lb_info is
written at the end.
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 |
1 |
stg_stuff = CREATE OLEStorage |
1 |
stg_stuff.Open("c:olemystuff.ole") |
1 |
olestr_info.Open(stg_stuff, "info", & |
1 |
stgReadWrite!, stgExclusive!) |
1 |
olestr_info.<span>Seek</span>(0, FromEnd!) |
1 |
olestr_info.Write(lb_info) |