FileSystem.LOF(Int32) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- FileNumber
- Int32
Required. An integer that contains a valid file number.
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
.
File mode is invalid.
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.
Use the FileLen
function to obtain the length of a file that is not open.
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: