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.
Applies to
OLEStream objects
Syntax
|
1 |
olestream.Seek ( position {, origin } ) |
|
Argument |
Description |
|---|---|
|
olestream |
The name of an OLE stream variable that has been |
|
position |
A long whose value is the position relative to origin to |
|
origin (optional) |
The value of the SeekType enumerated datatype specifying
|
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 — 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 2 3 4 5 6 7 8 9 10 |
boolean lb_memexists OLEStorage stg_stuff OLEStream olestr_info stg_stuff = CREATE OLEStorage stg_stuff.Open("c:olemystuff.ole") olestr_info.Open(stg_stuff, "info", & stgReadWrite!, stgExclusive!) olestr_info.Seek(0, FromEnd!) olestr_info.Write(lb_info) |
See also