July 2000
Intermediate to advanced
492 pages
14h 53m
English
Close (TextStream Object) —
tsObj
.Close
Closes a text file that has been opened as a TextStream object.
None
<%
' Dimension local variables.
Dim fsoObject ' FileSystemObject
Dim tsObject ' TextStream Object
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
"Scripting.FileSystemObject")
' Using the OpenTextFile method of fsoObject, initialize
' the File object.
Set tsObject = fsoObject.OpenTextFile( _
"d:\docs\test.txt", ForReading, False)
' Read into the string the contents of the text file.
strContents = tsObject.ReadAll
' Close the open text file.
tsObject.Close
. . . [additional code]
%>You can have only a limited number of open files in your application (similar to the use of open files in Visual Basic), so it is important to close all open text files after you are finished with them.
Read now
Unlock full access