FileLen Function

   
FileLen Function

Class

Microsoft.VisualBasic.FileSystem

Syntax

 FileLen(   pathname   ) 
pathname (required; String)

The filename, along with its path and drive name ( optionally )

Return Value

A Long containing the length of the specified file in bytes

Description

Specifies the length of a file on disk

Rules at a Glance

If you don't specify a drive or folder with pathname , the file is assumed to be in the current drive or folder.

Programming Tips and Gotchas

  • Use the File.Exists method in the System.IO namespace to determine that the file exists before calling FileLen . If the file does not exist, FileLen generates runtime error 53, "File not found."

  • Because FileLen returns the length of a file based on the file allocation table, the value returned by FileLen will reflect the size of the file before it was opened. In the case of open files, you should instead use the LOF function to determine the open file's current length.

See Also

LOF Function

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net