<< Back


FVSDK_Download

Synopsis

FVSDK_ERROR_CODE FVSDK_Download(FVSDK_Session* pSession, LPCTSTR pszSourcePath, LPCTSTR pszDestPath);

Description

Downloads one or more files from the connected server. If using wildcards, multiple files can be downloaded into a single directory (pszDestPath). Use this function when you want to download a file or files with a single function call. Use FVSDK_OpenFile() to download a single file in blocks, fully under your control.

When pSession->bConnectionSaver is TRUE (the default), this function waits (blocks) until the file transfer is complete. When pSession->bConnectionSaver is FALSE, this function returns prior to the transfer starting, making this function asynchronous (non-blocking).

Parameters

pSession

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

pszSourcePath

The remote path to a single file or the path to a directory with a wild carded name.

pszDestPath

The local path to a single file or a path where wild carded files are to be downloaded. If specifying a directory name for the destination, be sure to end the string with a \ character to signify a directory.

Return Value

FVSDK_OK if successful; error codes can be found in FVSDK_ErrorCodes.h.

NOTE: If the session structure is valid, this function always returns FVSDK_OK. This is done because transfers can be asynchronous if bConnectionSaver is set to FALSE. To be notified of transfer errors, use the appropriate callback function found in the FVSDK_Session structure.

Example

// turn off connection saver so the downloads are asynchronous (non-blocking)
pSession->bConnectionSaver = FALSE;

// apply the session changes
FVSDK_ApplySessionChange(pSession);

// NOTE: Because we turned connection saver off (above), the following functions will exit
// prior to completing the transfer

// download the file from the server (notice that the local file can be a different filename)
FVSDK_Download(pSession, "/pub/rhinosoft/ftpvoyager/fvsetup.exe", "D:\\Temp\\ftpvoyager.exe");

// download the file from the server
FVSDK_Download(pSession, "/pub/rhinosoft/ftpvoyager/ftpvgerman.exe", "D:\\Temp\\");

// download all text files in the provided path
FVSDK_Download(pSession, "/pub/rhinosoft/ftpvoyager/*.txt", "D:\\Temp\\");