Version: 3.0
This method opens a specified file and returns an instance of a TextStream object that can then be manipulated - read from, written or appended to.
iomode Values
| Constant | Value | Description |
| ForReading |
1
|
File is opened for reading only |
| ForWriting |
2
|
File is opened for writing and the contents of any existing file with the same name are overwritten |
| ForAppending |
8
|
Opens the file and writes to the end of any existing text. |
| Constant | Value | Description |
| TristateUseDefault |
-2
|
Uses the system default file format |
| TristateTrue |
-1
|
Opens the file using the Unicode format |
| TristateFalse |
0
|
Opens the file in AscII format |
<%
dim filesys, demofile, txtstream
set filesys = CreateObject ("Scripting.FileSystemObject")
set demofile = filesys.CreateTextFile ("c:\somefile.txt", true)
set demofile = filesys.GetFile("c:\somefile.txt")
set txtstream = demofile.OpenAsTextStream (2, -2)
txtstream.Write "This will overwrite any text already in the file."
txtstream.Close
%>