AtEndOfStream 屬性
如果檔案指標位於 TextStream 檔案末,則返回 True;否則如果不為只讀則返回 False。
object.AtEndOfStream
object 應為 TextStream 物件的名稱。
說明
AtEndOfStream 屬性僅應用於以只讀方式開啟的 TextStream 檔案,否則會出現錯誤。
下列程式碼舉例說明如何使用 AtEndOfStream 屬性:
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.AtEndOfStream <> True retstring = theFile.ReadLine Loop theFile.Close ReadEntireFile = retstringEnd Function
写评论
很抱歉,必須登入網站才能發佈留言。