Features
Ask DevGuru
ASP Resources
Find the Bug
Knowledge Base
Links
Tips of the Week
Tutorials
Products
dgCalendar
dgCharge New!
dgChart New!
dgFileUpload
dgReport New!
dgSort
dgTree
Site
Authoring
Coming Soon
DevGuru Resume
Link to Us
Merchandise
Sponsorships
Testimonials
What's New
Technologies
ADO 2.6
ASP
CSS2
HTML
JavaScript
Jet SQL
Transact-SQL Syntax
VBScript
WML
WMLScript
WSH
XML DOM
All Methods
TextStream Object
METHOD: TextStream.ReadAll
Implemented in version 2.0
object.
ReadAll
This method reads the entire contents of a text file and returns it as a string.
Code:
<%
dim filesys, text, readfile, contents
set filesys = CreateObject("Scripting.FileSystemObject")
Set text = filesys.CreateTextFile("c:\somefile2.txt")
text.Write "A quick example of the ReadAll method"
text.close
set readfile = filesys.OpenTextFile("c:\somefile2.txt", 1, false)
contents = readfile.ReadAll
readfile.close
Response.Write "The file contains the following text - '" & contents & "'."
%>
Output:
"The file contains the following text - 'A quick example of the ReadAll method'.
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information