Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/File-size/Visual-Basic/file-size.vb
Normal file
25
Task/File-size/Visual-Basic/file-size.vb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
Option Explicit
|
||||
|
||||
----
|
||||
|
||||
Sub DisplayFileSize(ByVal Path As String, ByVal Filename As String)
|
||||
Dim i As Long
|
||||
If InStr(Len(Path), Path, "\") = 0 Then
|
||||
Path = Path & "\"
|
||||
End If
|
||||
On Error Resume Next 'otherwise runtime error if file does not exist
|
||||
i = FileLen(Path & Filename)
|
||||
If Err.Number = 0 Then
|
||||
Debug.Print "file size: " & CStr(i) & " Bytes"
|
||||
Else
|
||||
Debug.Print "error: " & Err.Description
|
||||
End If
|
||||
End Sub
|
||||
|
||||
----
|
||||
|
||||
Sub Main()
|
||||
DisplayFileSize CurDir(), "input.txt"
|
||||
DisplayFileSize CurDir(), "innputt.txt"
|
||||
DisplayFileSize Environ$("SystemRoot"), "input.txt"
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue