Write PowerScript function
Description
Writes data to an opened OLE stream
object.
Controls
OLEStream objects
Syntax
|
1 |
<span>olestream</span>.<span>Write</span> ( <span>dataforstream</span> ) |
|
Argument |
Description |
|---|---|
|
olestream |
The name of an OLE stream variable that |
|
dataforstream |
A string, blob, or character array whose |
Return Values
Long. Returns the number of characters
or bytes written 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, Write returns null.
Examples
This example opens an OLE object in the file MYSTUFF.OLE and
assigns it to the OLEStorage object olest_stuff.
Then it opens the stream called info in olest_stuff and
assigns it to the stream object olestr_info.
It writes the contents of the blob variable lb_info to
the stream olestr_info. Finally, it
saves the storage olest_stuff:
|
1 |
boolean lb_memexists |
|
1 |
OLEStorage olest_stuff |
|
1 |
OLEStream olestr_info |
|
1 |
integer li_result<br>long ll_result |
|
1 |
|
1 |
olest_stuff = CREATE OLEStorage |
|
1 |
li_result = olest_stuff.Open("c:ole2mystuff.ole") |
|
1 |
IF li_result <> 0 THEN RETURN |
|
1 |
|
1 |
li_result = olestr_info.Open(olest_stuff, "info", & |
|
1 |
stgReadWrite!, stgExclusive!) |
|
1 |
IF li_result <> 0 THEN RETURN |
|
1 |
ll_result = olestr_info.<span>Write</span>(lb_info) |
|
1 |
IF ll_result = 0 THEN olest_stuff.Save() |