<< Back


FVSDK_Size

Synopsis

FVSDK_ERROR_CODE FVSDK_Size(FVSDK_Session* pSession, LPCTSTR pszPathName, FVSDK_FILE_SIZE* pFileSize);

Description

Retrieves the size of a file in bytes. Use of this function can be faster than using directory listings when a listing and the associated overhead is too slow. Using this function sends the SIZE command to the server for the file specified by pszPathName.

Parameters

pSession

A pointer to the FVSDK_Session that is to perform the operation.

pszPathName

The full path name to the file.

pFileSize

A pointer to a FVSDK_FILE_SIZE variable to contain the file size returned by the server.

Return Value

FVSDK_YES if the function was successful; FVSDK_NO if the SIZE command failed. Error codes can be found in FVSDK_ErrorCodes.h.

Example

FVSDK_FILE_SIZE FileSize;

// get the size of the file
if (FVSDK_Size(pSession, "/pub/file.txt", &FileSize) == FVSDK_YES) {
    CString sMsg;

    // build a message to display to the user
    sMsg.Format("The file size is %I64d bytes.", FileSize);

    // display a message to the user
    AfxMessageBox(sMsg, MB_ICONINFORMATION);
} // if
else 
    AfxMessageBox("Unable to get the file size.");