August 1999
Intermediate to advanced
1488 pages
72h 53m
English
textstream.Write(string)
The Write() method of an instance of the TextStream object is used to write a string to the text file.
Listing 9.134 opens a text file and writes a string to it. This file can be executed with the Windows Scripting Host (wscript.exe or cscript.exe).
// Create a FileSystemObject object
var myFileSysObj = new ActiveXObject("Scripting.FileSystemObject")
// Create a TextStream object
var myTextStream = myFileSysObj.OpenTextFile("c:\\temp\\test.txt", 2, true)
// Write a string to the file
myTextStream.Write("Hello, World!");
// Close the stream to the file
myTextStream.Close();
|
Read now
Unlock full access