FileSystem.LOF 方法
傳回 Long,表示使用 FileOpen 函式開啟的檔案之大小 (以位元組為單位)。My 功能提供比 LOF 更強的檔案 I/O 作業產能和效能。如需詳細資訊,請參閱 My.Computer.FileSystem 物件。
命名空間: Microsoft.VisualBasic
組件: Microsoft.VisualBasic (在 microsoft.visualbasic.dll 中)
語法
'宣告
Public Shared Function LOF ( _
FileNumber As Integer _
) As Long
'用途
Dim FileNumber As Integer
Dim returnValue As Long
returnValue = FileSystem.LOF(FileNumber)
public static long LOF (
int FileNumber
)
public:
static long long LOF (
int FileNumber
)
public static long LOF (
int FileNumber
)
public static function LOF (
FileNumber : int
) : long
參數
- FileNumber
必要項。包含有效檔案編號的 Integer。
傳回值
傳回 Long,表示使用 FileOpen 函式開啟的檔案之大小 (以位元組為單位)。My 功能提供比 LOF 更強的檔案 I/O 作業產能和效能。如需詳細資訊,請參閱 My.Computer.FileSystem 物件。
備註
如需詳細資訊,請參閱 Visual Basic 的主題 LOF 函式。
使用 FileLen 函式取得尚未開啟的檔案之長度。
範例
此範例使用 LOF 函式來判斷開啟檔案的大小。此範例假設 TestFile
是一個包含範例資料的文字檔。
Dim length As Long
FileOpen(1, "C:\TESTFILE.TXT", OpenMode.Input) ' Open file.
length = LOF(1) ' Get length of file.
MsgBox(length)
FileClose(1) ' Close file.
平台
Windows 98、 Windows 2000 SP4、 Windows Millennium Edition、 Windows Server 2003、 Windows XP Media Center Edition、 Windows XP Professional x64 Edition、 Windows XP SP2、 Windows XP Starter Edition
.NET Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱系統需求一節的內容。
版本資訊
.NET Framework
支援版本:2.0、1.1、1.0
請參閱
參考
FileSystem 類別
FileSystem 成員
Microsoft.VisualBasic 命名空間
IOException Class
其他資源
LOF 函式
EOF 函式
FileLen 函式
Loc 函式
FileOpen 函式
在 Visual Basic 中讀取檔案
在 Visual Basic 中寫入檔案