please dont rip this site
Microsoft® JScript™
OpenAsTextStream Method
 Language Reference 
 Version 3 

See Also                  Applies To


Description
Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
Syntax
object.OpenAsTextStream([iomode, [format]])

The OpenAsTextStream method syntax has these parts:

Part Description
object Required. Always the name of a File object.
iomode Optional. Indicates input/output mode. Can be one of three constants: ForReading, ForWriting, or ForAppending.
format Optional. One of three Tristate values used to indicate the format of the opened file. If omitted, the file is opened as ASCII.
Settings
The iomode argument can have any of the following settings:

Constant Value Description
ForReading 1 Open a file for reading only. You can't write to this file.
ForWriting 2 Open a file for writing. If a file with the same name exists, its previous contents are overwritten.
ForAppending 8 Open a file and write to the end of the file.
The format argument can have any of the following settings:

Constant Value Description
TristateUseDefault -2 Opens the file using the system default.
TristateTrue -1 Opens the file as Unicode.
TristateFalse  0 Opens the file as ASCII.
Remarks
The OpenAsTextStream method provides the same functionality as the OpenTextFile method of the FileSystemObject. In addition, the OpenAsTextStream method can be used to write to a file.

The following code illustrates the use of the OpenAsTextStream method:

function TextStreamTest( )
{
    var ForReading = 1, ForWriting = 2, ForAppending = 3;
    var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
    var fs, f, ts, s;
    fs = new ActiveXObject("Scripting.FileSystemObject");
    fs.CreateTextFile( "test1.txt" );           // Create a file
    f = fs.GetFile("test1.txt");
    ts = f.OpenAsTextStream(ForWriting, TristateUseDefault);
    ts.Write( "Hello World" );
    ts.Close( );
    ts = f.OpenAsTextStream(ForReading, TristateUseDefault);
    s = ts.ReadLine( );
    window.alert (s);
    ts.Close( );
}

© 1997 by Microsoft Corporation. All rights reserved.


file: /Techref/inet/iis/jscript/htm/js278.htm, 5KB, , updated: 1997/9/30 04:44, local time: 2024/10/31 18:27,
TOP NEW HELP FIND: 
3.135.202.122:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/techref/inet/iis/jscript/htm/js278.htm"> OpenAsTextStream Method</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?