StreamEnd
(Engine-Level Function)
Description: | Returns whether a stream is at the end. |
Returns: | Boolean |
Usage: | Script Only. |
Function Groups: | Stream and Socket |
Related to: | BuffStream | ClientSocket | FileStream | GetStreamLength | PipeStream | ServerSocket | LargeSocketWrite |
Format: | StreamEnd(Stream) |
Parameters: |
Stream |
Required. Any stream to test. |
Comments: | This function returns true (1) if the current stream pointer for Stream is at the end of the stream and false (0) otherwise. |
Example:
If MatchKeys(2, "r"); [ SRead(file1, "%d%n", val, filePos); end = StreamEnd(file1); ] ZText(10, 30, Concat("At end of file ? ", end), 11, 0); ZText(10, 40, Concat("Position in file = ", filePos), 11, 0); ZText(10, 50, Concat("The value is ", val), 11, 0);
In this example, every time the user presses the letter r on the keyboard, a new data value is read and a check is done on whether the end of the file has been reached. All of these values are written to the screen. Note that the position in the file (filePos) that is displayed by the ZText command is the position after the read has taken place.