VBScript 中forReading的用法

来源:百度知道 编辑:UC知道 时间:2024/05/30 00:53:09
代码没有换行,
代码的作用好像是得到文件filespec的最后一个字符。

设置只读属性
例:
Function ReadEntireFile(filespec)
Const ForReading = 1
Dim fso, theFile, retstring
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile = fso.OpenTextFile(filespec, ForReading, False) Do While theFile.AtEndOfLine <> True retstring = theFile.Read(1) Loop theFile.Close ReadEntireFile = retstringEnd Function