JScript Language Reference --------------------------------------------------------------------------------Read Method
Reads a specified number of characters from a TextStream file and returns the resulting string.object.Read(characters)Arguments
objectRequired. Always the name of a TextStream object.charactersRequired. Number of characters you want to read from the file.The following example illustrates how to use the Read method to read a six character header from a file and return the resulting string: function GetHeader()
{
var fso, f;
var ForReading = 1, ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true);
f.Write("Header");
f.Write("1234567890987654321");
f.Close();
f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
return(f.Read(6));
}
See Also
Reads a specified number of characters from a TextStream file and returns the resulting string.object.Read(characters)Arguments
objectRequired. Always the name of a TextStream object.charactersRequired. Number of characters you want to read from the file.The following example illustrates how to use the Read method to read a six character header from a file and return the resulting string: function GetHeader()
{
var fso, f;
var ForReading = 1, ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true);
f.Write("Header");
f.Write("1234567890987654321");
f.Close();
f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
return(f.Read(6));
}
See Also
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货