Easy Tutorial
❮ Met Close Prop Parentfolder Folder ❯

ASP TextStream Object


The TextStream object is used to access the contents of a text file.


Try It Yourself - Examples

Read Text File

Read a Part of Text File

Read a Line from Text File

Read All Lines from Text File

Skip a Part of Text File

Skip a Line from Text File

Return Line Number

Get Column Number


TextStream Object

The TextStream object is used to access the contents of a text file.

The following code will create a text file (c:\test.txt) and then write some text to this file (the variable f is an instance of the TextStream object):

To create an instance of the TextStream object, you can use the CreateTextFile method or the OpenTextFile method of the FileSystemObject object, or you can use the OpenAsTextStream method of the File object.

The properties and methods of the TextStream object are described below:

Properties

Property Description
AtEndOfLine Returns True if the file pointer is positioned immediately before the end-of-line marker in a TextStream file; otherwise, it returns False.
AtEndOfStream Returns True if the file pointer is at the end of a TextStream file; otherwise, it returns False.
Column Returns the column number of the current character position in the input stream of a TextStream file.
Line Returns the current line number in a TextStream file.

Methods

Method Description
Close Closes an open TextStream file.
Read Reads a specified number of characters from a TextStream file and returns the result.
ReadAll Reads an entire TextStream file and returns the result.
ReadLine Reads an entire line (up to, but not including, the newline character) from a TextStream file and returns the result.
Skip Skips a specified number of characters when reading a TextStream file.
SkipLine Skips the next line when reading a TextStream file.
Write Writes the specified text to a TextStream file.
WriteLine Writes the specified text and a newline character to a TextStream file.
WriteBlankLines Writes a specified number of newline characters to a TextStream file.
❮ Met Close Prop Parentfolder Folder ❯