Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Methods
TextStream Object
METHOD: TextStream.Read
Implemented in version 2.0
object.
Read
This method reads the number of characters you specify from a
Textstream
file and returns them as a string. If you specify more characters than actual exist in the file, then
Read
only returns the actual number of characters that are in the file.
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 Read method"
text.close
set readfile = filesys.OpenTextFile("c:\somefile2.txt", 1, false)
contents = readfile.Read(7)
readfile.close
Response.Write "The first seven characters in the text file are '" & contents & "'."
%>
Output:
"The first seven characters in the text file are 'A quick'.
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information