संपादित करें

इसके माध्यम से साझा किया गया


FileSystem.LOF(Int32) Method

Definition

Returns the size, in bytes, of a file opened by using the FileOpen function. The My feature gives you better productivity and performance in file I/O operations than LOF. For more information, see FileSystem.

public:
 static long LOF(int FileNumber);
public static long LOF (int FileNumber);
static member LOF : int -> int64
Public Function LOF (FileNumber As Integer) As Long

Parameters

FileNumber
Int32

Required. An integer that contains a valid file number.

Returns

The size, in bytes, of a file opened by using the FileOpen function. The My feature gives you better productivity and performance in file I/O operations than LOF.

Exceptions

File mode is invalid.

Examples

This example uses the LOF function to determine the size of an open file. This example assumes that TestFile is a text file that contains sample data.

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.

Remarks

Use the FileLen function to obtain the length of a file that is not open.

Applies to

See also