For OLE stream objects Reads data from an opened OLE stream object.
To |
Use |
---|---|
Read data into a string |
|
Read data into a character array or blob |
For FileDirect objects Reads a file that you open using the FileDirect object.
To |
Use |
---|---|
Read data into an array |
|
Read data into a blob |
Reads data from an OLE stream object into a string.
OLEStream objects
olestream.Read ( variable {, stopforline } )
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 a negative integer if an error occurs.
Reads data from an OLE stream object into a character array or blob.
OLEStream objects
olestream.Read ( variable {, maximumread } )
Integer. Returns 0 if it succeeds and a negative integer if an error occurs.
Reads data from an open file into an array.
FileDirect objects
Integer instancename.Read ( data[ ], bytesrequested, bytesread)
Argument |
Description |
---|---|
instancename |
Name of the instance of the FileDirect object |
data[ ] |
An array of unsignedlong datatypes to contain the data that you read from a file |
bytesrequested |
Integer for the number of bytes that you want to read in the open file |
bytesread |
Integer for storing the number of bytes read in the file |
Integer. Returns 1 for success and a negative number for any error.
Use this function to read a file that you open with the FileDirect object in read mode. The FileDirect object supports only the synchronous style of file output; further file-related commands cannot be called until after the Read function is fully processed or an error in reading the file is caught.
The following example calls the FileDirect user object nvo_fileDirect to open a file, read some data, store the data in an array, and close the file:
Integer li_ret, li_AmountRead
Unsignedlong li_data [ ] li_ret = nvo_fileDirect.Open ("COM8:", stgReadWrite!) li_ret = nvo_fileDirect.Read (li_data[], 100, li_amountRead) li_ret = nvo_fileDirect.Close ( )
Reads data from an open file into a blob.
FileDirect objects
Integer instancename.Read ( bdata, bytesrequested, bytesread)
Argument |
Description |
---|---|
instancename |
Name of the instance of the FileDirect object |
bdata |
A blob variable to hold the data that you read from a file |
bytesrequested |
Integer for the number of bytes that you want to read in the open file |
bytesread |
Integer for for storing the number of bytes read in the file |
Integer. Returns 1 for success and a negative number for any error.
Use this function to read a file that you open with the FileDirect object in read mode. The FileDirect object supports only the synchronous style of file output; further file-related commands cannot be called until after the Read function is successfully processed or until an error in reading the file is caught.
The following example calls the FileDirect user object nvo_fileDirect to open a file, read some data, store the data in a blob variable, and close the file:
Integer li_ret, li_AmountRead Blob lb_data li_ret = nvo_fileDirect.Open ("MyDoc.txt", stgRead!) li_ret = nvo_fileDirect.Read (lb_data, 100, li_amountRead) li_ret = nvo_fileDirect.Close ( )