Version: 2.0
Opens the file specified in the filename parameter and returns an instance of the TextStreamObject for that file. )
This method is used to open a text file and returns a TextStreamObject that can then be used to write to, append to, and read from the file.
iomode Constants
CONSTANT | VALUE | DESCRIPTION |
---|---|---|
ForReading | 1 | Opens a file for reading only |
ForWriting | 2 | Opens a file for writing. If the file already exists, the contents are overwritten. |
ForAppending | 8 | Opens a file and starts writing at the end (appends). Contents are not overwritten. |
CONSTANT | VALUE | DESCRIPTION |
---|---|---|
TristateTrue | -1 | Opens the file as Unicode |
TristateFalse | 0 | Opens the file as ASCII |
TristateUseDefault | -2 | Use default system setting |
<%
dim filesys, filetxt
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("c:\somefile.txt", ForAppending, True)
filetxt.WriteLine("Your text goes here.")
filetxt.Close
%>
This example will open the file, "c:\somefile.txt" (or create it if it does not exist), and append the specified text to it.