Set MyFileObject = Server.CreateObject ("Scripting.FileSystemObject")
set theFolder=MyFileObject.getfolder(folderPath)
Set thisfile = MyFileObject.opentextfile(x)
do while not thisfile.atendofstream
textLine = thisfile.readline()
response.write textLine
loop
set theFolder=MyFileObject.getfolder(folderPath)
Set thisfile = MyFileObject.opentextfile(x)
do while not thisfile.atendofstream
textLine = thisfile.readline()
response.write textLine
loop
从TextStream 文件中读取一整行(一直到换行符,但不包括换行符),并返回由此得到的字符串。object.ReadLine( )object 参数总是 TextStream 对象的名称。 说明
下面的示例演示了Line 属性的用法:function GetLine()
{
var fso, f, r;
var ForReading = 1, ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true);
f.WriteLine("Hello world!");
f.WriteLine("JScript is fun");
f.Close();
f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
r = f.ReadLine();
return(r);
}