ASP Tutorials - Herong's Tutorial Examples - v5.10, by Dr. Herong Yang
"TextStream" Class - Input or Output Stream
This section provides a tutorial example on how to use the TextStream class that represents an input or output stream connected to a file. TextStream class is provided in the Scripting Runtime DLL, scrrun.dll.
TextStream: A class representing an input or output stream connected to a file. It offers the following properties and methods:
Here is a sample ASP page to show you how to create and open a text file.
<script language="vbscript" runat="server"> ' text_stream_test.asp ' Copyright (c) 1999 by Dr. Herong Yang ' This program shows how to create and open files as text stream ' objects. ' response.write("<html><body>") response.write("<b>Tests on the TextStream class</b>:<br/>") ' Getting the FileSystemObject set fs = CreateObject("Scripting.FileSystemObject") ' Creating a new file for writing set out = fs.CreateTextFile("c:\temp\test.txt",true,false) out.WriteLine("FirstName=Bill") out.WriteLine("LastName=Smith") out.WriteLine("Email=bill@com.com") out.Close() ' Open an existing file for reading set inn = fs.OpenTextFile("c:\temp\test.txt",1) while inn.AtEndOfStream = false line = inn.ReadLine() response.write(line & "<br/>") wend inn.Close() response.write("</body></html>") </script>
Output:
Tests on TextStream class: FirstName=Bill LastName=Smith Email=bill@com.com
Note that:
Table of Contents
ASP (Active Server Pages) Introduction
IIS (Internet Information Services) 5.0
Managing Sessions with and without Cookies
►scrrun.dll - Scripting Runtime DLL
"Dictionary" Class - Collection of Key-Value Pairs
"FileSystemObject" Class - File System
►"TextStream" Class - Input or Output Stream
Managing Response Header Lines
Calculation Speed and Response Time
Working with MS Access Database