CloseStream
(Engine-Level Function)
Description: | Closes and flushes any type of open stream and returns its own error code. |
Returns: | Boolean |
Usage: | Script Only. |
Function Groups: | Stream and Socket |
Related to: | BuffStream | FileStream | PipeStream | StreamEnd |
Format: | CloseStream(Stream[, CloseType]) |
Parameters: |
Stream | ||||||
Required. Any expression that returns a stream value. | ||||||
CloseType | ||||||
Optional. Short integer with the following definitions:
|
Comments: | The return value is true if the stream is successfully closed and invalid otherwise. This function closes the stream passed to it. If the stream is invalid, or the stream is already closed, nothing happens. |
Example:
If GetStreamLength(Stream) == 0 && ! Valid(CloseOK); [ CloseOK = CloseStream(Stream); ]
This example checks to see if the stream has any data in it, and if it is empty and has not already been closed, closes it, setting CloseOK to 1 if the stream were closed and invalid otherwise.