ASP OpenAsTextStream Method
Complete File Object Reference
The OpenAsTextStream method opens the specified file and returns a TextStream object to access the file.
Syntax
|
FileObject.OpenAsTextStream(mode,format)
|
| Parameter |
Description |
| mode |
Optional. How to open the file.
- 1 = ForReading - Open a file for reading. You cannot write to this file
- 2 = ForWriting - Open a file for writing
- 8 = ForAppending - Open a file and write to the end of the file
|
| format |
Optional. The format of the file.
- 0 = TristateFalse - Default. Open the file as ASCII
- -1 = TristateTrue - Open the file as Unicode
- -2 = TristateUseDefault - Open the file using the system default
|
Example
<%
dim fs,f,ts
set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile("c:\test.txt")
Set ts=f.OpenAsTextStream(ForWriting)
ts.Write("Hello World!")
ts.Close
Set ts=f.OpenAsTextStream(ForReading)
Response.Write(ts.ReadAll)
ts.Close
set ts=nothing
set f=nothing
set fs=nothing
%>
Output:
Hello World!
|
Complete File Object Reference
Stylus Studio® 2010 XML Enterprise Suite raises the bar for productivity in XML development tools.
Millions of XML developers and data integration specialists turn to Stylus Studio's comprehensive and intuitive
XML toolset to tackle today's advanced XML data transformation and aggregation challenges.
|
- XML Pipeline Editor, Debugger and Code Generator
- DataDirect XML Converters
- XQuery Mapper, Editor, Debugger, and Profiler
- XSLT Mapper, Editor, Debugger, Designer, and Profiler
- Java and C# for .Net Code Generation
- XML Schema Designer With Documentation Generator
- XML Editor With Full XPath Integration
Download a free trial now
|
|