Version: 2.0
The TextStream object provides sequential access to the contents of any file where the contents are in text-readable form. You can create an instance of the TextStream object using the CreateTextFile or OpenTextFile methods of the FileSystemObject object, or alternatively by using the OpenAsTextStream method of the File object.
<%
Dim filesys, testfile
Set filesys = CreateObject("Scripting.FileSystemObject")
Set testfile= filesys.CreateTextFile("c:\somefile.txt", True)
testfile.WriteLine "Your text goes here."
testfile.Close
%>
In this code the CreateTextFile method is used on the FileSystemObject to return the TextStream object, "testfile". This TextStream object is then manipulated using the WriteLine and Close methods.
Syntax: object.AtEndOfLine
Returns a Boolean value. If the file pointer is positioned immediately before the file's end-of-line marker, the value is True, and False otherwise.
Syntax: object.AtEndOfStream
Returns a Boolean value. If the file pointer is positioned at the end of a file, the value is True, and False otherwise.
Syntax: object.Column
Returns the current position of the file pointer within the current line. Column 1 is the first character in each line.
Syntax: object.Line
This property returns the current line number in a text file.
Syntax: object.Close
Closes a currently open TextStream file.
Syntax: object.Read(characters)
This method reads the number of characters you specify from a Textstream file and returns them as a string.
Syntax: object.ReadAll
This method reads the entire contents of a text file and returns it as a string.
Syntax: object.ReadLine
Reads a single line (excluding the newline character) from a TextStream file and returns the contents as a string.
Syntax: object.Skip(numberofcharacters)
Causes the file pointer to skip ahead a specified number of characters when reading a TextStream file.
Syntax: object.SkipLine
Moves the file pointer from its current position to the beginning of the next line.
Syntax: object.Write(string)
This method writes a supplied string to an open TextStream file.
Syntax: object.WriteBlankLines(lines)
Used to write a number of consecutive newline characters (defined with the lines parameter) to a TextStream file.
Syntax: object.WriteLine([string])
Writes a supplied string to a TextStream file, followed by a new line character.