Features
Ask DevGuru
ASP Resources
Find the Bug
Knowledge Base
Links
Tips of the Week
Tutorials
Products
dgCalendar
dgCharge New!
dgChart New!
dgFileUpload
dgReport New!
dgSort
dgTree
Site
Authoring
Coming Soon
DevGuru Resume
Link to Us
Merchandise
Sponsorships
Testimonials
What's New
Technologies
ADO 2.6
ASP
CSS2
HTML
JavaScript
Jet SQL
Transact-SQL Syntax
VBScript
WML
WMLScript
WSH
XML DOM
All Methods
File Object
METHOD: File.OpenAsTextStream
Implemented in version 3.0
object.
OpenAsTextStream
([iomode [, format]])
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.
This method has two optional parameters. The first,
iomode
, has the following available 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.
The second optional parameter,
format
, can have any of the following values:
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
Code:
<%
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
%>
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information