Returns a Boolean value indicating whether the end of an input stream has been reached.
object.AtEndOfStream |
Arguments
- object
-
StdIn text stream object.
Remarks
The AtEndOfStream property contains a Boolean value indicating whether the end of an input stream has been reached. The AtEndOfStream property returns True if the stream pointer is at the end of an input stream, False if not. The StdIn, StdOut, and StdErr properties and methods work only when the script is run with CScript.exe. If the script is run with WScript.exe, an error occurs.
Example
The following code samples demonstrate the AtEndOfStream property by reading a standard directory listing from "dir", stripping the top and bottom lines that aren't actual entries, and double spacing the directory entries.
Visual Basic Script | Copy Code |
---|---|
Dim StdIn, StdOut, Str1, Str2 Set StdIn = WScript.StdIn Set StdOut = WScript.StdOut Str1 = "" Str2 = ""For i = 0 to 4 StdIn.SkipLine Next i = 0 Do While Not StdIn.AtEndOfStream If i >= 2 Then StdOut.WriteLine Str1 End If i = i + 1 Str1 = Str2 Str2 = StdIn.ReadLine Loop |
JScript | Copy Code |
---|---|
var stdin = WScript.StdIn; var stdout = WScript.StdOut; var str1, str2 = ""; var i; for (i = 0; i < 5; i++) stdin.SkipLine(); i = 0; while (!stdin.AtEndOfStream) { if (i++ >= 2) { stdout.WriteLine(str1); } str1 = str2; str2 = stdin.ReadLine(); } |