FileSystem.OpenTextFile() (Method)

A method for opening text files for I/O.

Availability:

JScript - 3.0
Internet Explorer - 4.0
Property/method value type:File object
JavaScript syntax:IEmyFileSystem.OpenTextFile(aName, aMode, aFlag, aFormat)
Argument list:aNameThe name of the file to be created
aFlagA flag indicating whether the file can be created if necessary
aModeAn access mode for the file
aFormatA format control for the file

Yet another way to open files that is named inconsistently with every other way that files can be operated on. In this case, we are opening files from the file system's point of view.

It is recommended that you select only one preferred technique for opening text files for I/O and sticking to it. If you mix and match and use several alternatives, you will become confused and so will everyone else who has to maintain your scripts in the future.

This is the equivalent of a File.Open() when the JScript interpreter in the Windows environment needs to read the contents of the text in the file.

The mode parameter should be one of:

The format parameter can be set to open the file with a Unicode or ASCII character set. The default is ASCII if you request the system default value. This parameter is indicated with a numeric value as follows:

ValueFormat
-2Use system default
-1Unicode text format
0ASCII text format

See also:File object, File.open(), File.OpenAsTextStream(), TextStream object