ASP OpenTextFile Method
Definition and Usage
The OpenTextFile method opens the specified file and returns a TextStream object that can be used to access this file.
Syntax:
FileSystemObject.OpenTextFile(fname,mode,create,format)
Parameter | Description |
---|---|
fname | Required. The name of the file to be opened. |
mode | Optional. How to open the file.
|
create | Optional. Set whether to create a new file if the file name does not exist. True indicates that a new file can be created, while False indicates that a new file will not be created. False is the default. |
format | Optional. File format.
|
Instance
<% dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.OpenTextFile(Server.MapPath("testread.txt"),8,true) f.WriteLine("This text will be added to the end of file") f.Close set f=Nothing set fs=Nothing %>