Name

OpenAsTextStream (File Object) — tsObject = filObj .OpenAsTextStream [ intAccessMode ][, intFormat ]

Synopsis

Opens a file and creates a TextStream object that you can use to read or modify the text file. The method returns a TextStream object.

Parameters

intAccessMode

An integer that indicates the input/output mode in which you wish to open the text file. Possible values for this parameter are as follows:

Constant

Value

Description

ForReading

1

The file will be opened as read-only and cannot be modified by the current TextStream object.

ForWriting

2

The file will be opened for writing. If the file already exists when you call the OpenAsTextStream method, the original file is overwritten.

ForAppending

8

The file is opened for appending only. You can only add characters to the end of this file.

intFormat

An integer that indicates the format of the file to be opened as a TextStream object. The possible values for this parameter are thought of as a single tristate value. The file is Unicode, ASCII, or whichever is the system default. Possible values for this parameter are:

Constant

Value

Description

TristateUseDefault

-2

The file format will be the same as the default for the web server (Unicode or ASCII).

TristateTrue

-1

The file format will be Unicode.

TristateFalse

0

The file format will be ASCII.

Example

<% ' Dimension local variables. Dim fsoObject ' FileSystemObject Dim filObject ' File Object Dim tsObject ' TextStream object ' Declare ...

Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.