Write 方法
将给定的字符串写入到一个 TextStream 文件。 object .Write( string ) 参数 object 必选项。总是一个 TextStream 对象的名称。 string 必选项。要写入文件的文本。 说明 给定的字符串在写入该文件时
将给定的字符串写入到一个 TextStream 文件。
object.Write(string)
参数
object
必选项。总是一个 TextStream 对象的名称。
string
必选项。要写入文件的文本。
说明
给定的字符串在写入该文件时不会在字符串之间插入空格或字符。可以使用 WriteLine 方法来写入一个换行符或以换行符结束的字符串。
下面的示例演示了Write 方法的用法:
function WriteDemo() {
var fso, f, r
var ForReading = 1, ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject")
f = fso.OpenTextFile("c: estfile.txt", ForWriting, true)
f.Write("Hello world!");
f.Close();
f = fso.OpenTextFile("c: estfile.txt", ForReading);
r = f.ReadLine();
return(r);
}
请参阅
WriteBlankLines 方法 WriteLine 方法应用于: TextStream 对象
- 上一篇:SkipLine 方法
- 下一篇:Skip 方法
精彩图集
精彩文章