ASP TextStream Object
The TextStream object is used to access the contents of a text file.
Examples
Read textfile
This example demonstrates how to use the OpenTextFile method of the FileSystemObject
to create a TextStream Object. The ReadAll method of the TextStream Object
reads from the opened text file.
Read only a part of
a textfile
This example demonstrates how to only read a part of a TextStream file.
Read one line of a textfile
This example demonstrates how to read one line from a TextStream file.
Read all lines from a textfile
This example demonstrates how to read all the lines from a TextStream file.
Skip a part of a textfile
This example demonstrates how to skip a specified number of characters when
reading the TextStream file.
Skip a line of a textfile
This example demonstrates how to skip a line when reading the TextStream file.
Return line-number
This example demonstrates how to return the current line number in a TextStream
file.
Get column number
This example demonstrates how to get the column number of the current character in a
file.
The TextStream Object
The TextStream object is used to access the contents of text files.
The following code creates a text file (c:\test.txt) and then writes some text
to the file (the variable f is an instance of the TextStream object):
<%
dim fs, f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("c:\test.txt",true)
f.WriteLine("Hello World!")
f.Close
set f=nothing
set fs=nothing
%>
|
To create an instance of the TextStream object you can use the CreateTextFile or OpenTextFile methods of the FileSystemObject object,
or you can use the OpenAsTextStream method of the File object. The TextStream object's properties and methods 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, and false if not |
| AtEndOfStream |
Returns true if the file pointer is at the end of a
TextStream file, and false if not |
| Column |
Returns the column number of the current character position
in an input stream |
| 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 one line 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 a specified text to a TextStream file |
| WriteLine |
Writes a specified text and a new-line character to a TextStream file |
| WriteBlankLines |
Writes a specified number of new-line character to a TextStream file |
 |
 |
 |
 |
|
The Ektron Intranet
lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.
What can you do with the Ektron Intranet? |
 |
Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search |
 |
Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform |

|
Utilize the extensive out-of-the box features or customize your site through Ektron CMS400.NET's open architecture |
 |
Promote collaboration in your organization through project workspaces where others can efficiently find information and work together |
 |
Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management |
|
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
|
|
 |
TAKE THE VIDEO TOUR |
 |
or download a FREE TRIAL today. |
|