GetFileSize
Top  Previous  Next

Description

Returns the size of the specified file in the device in bytes.


Syntax


[VB]
Value=objActiveUSB.GetFileSize( Name )


[C/C++]
HRESULT GetFileSize(bstr Name, long* pValue );


Data Types
[VB]

Name: String
Return value
: Single


Parameters
[C/C++]

Name [in]  
String specifying the name of the file in the device  
pValue [out, retval]  
Pointer to the size of the file in bytes  


Return Values


S_OK  
Success  
E_NOINTERFACE        
File with the specified name does not exist in the device  
E_FAIL  
Failure  
 

Example


This VB example initializes a combo box with the names of files hosted on the camera and displays the size of the selected file:

Private Sub
 Form_Load()
FileList = ActiveUSB1.GetFileList
For
 i = 0 
To
 
UBound
(FileList)
Combo1.AddItem (FileList(i))
Next

End Sub

Private Sub
 Combo1_Click()
FileName=Combo1.Text
Label1.Caption = ActiveUSB1.GetFileSize (FileName)
End Sub
 

Remarks


The File Access functionality allows an application to read and write files hosted on the device. The data in those files may contain look-up tables, configuration sets, firmware, and other information.

The size of the file can be used to reserve a proper amount of memory for the data transfer or to determine the maximum amount of bytes that can be written into the file.