Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference > Siebel VB Language Reference >
Lof Function
This standard VB function returns the length in bytes of an open file.
Syntax
Lof(filenumber)
Returns
The length of the open file, in bytes.
Usage
The filenumber is the number used in the Open statement that opened the file.
Example
This example opens a file and prints its contents to the screen.
Sub Button_Click
Dim fname As String,fchar() As String
Dim x As Integer, msgtext As String, newline As String
newline = Chr(10)
fname = "d:\temp\trace.txt"
On Error Resume Next
Open fname for Input as #1
If Err <> 0 then
Exit Sub
End If
msgtext = "The contents of " & fname & " is: " _
& newline & newline
Redim fchar(Lof(1))
For x = 1 to Lof(1)
fchar(x) = Input(1,#1)
msgtext = msgtext & fchar(x)
Next x
Close #1
End SubSee Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference Published: 18 June 2003 |