wodSFTP API library - GetDataToBuffer Method
      
 

Description

Retrieves the contents of a remote file to a locally specified buffer.


Return type

A Long value. If successful, 0 is returned, otherwise error as specified here.


Syntax

long Sftp_GetDataToBuffer(void *Sftp, char * RemoteFile, char *Buffer, int BufSize);

The GetDataToBuffer function syntax has these parts:

Part Description
void *Sftp Handle of the created Sftp instance.
char *RemoteFile Full path to a file on the server.
char *Buffer Pointer to an allocated buffer where data will be stored.
int *BufSize Pointer to the size of the buffer.

Remarks

Unlike the GetFile method which copies a file from a remote server to a local file, GetDataToBuffer will get part of the file from the server and copy it to the buffer you have allocated. When the transfer is complete the Done callback will fire.

If the size of the buffer is too small, wodSFTPdll will only copy up to the size you specify and then cease to download any more data. When all data is retrieved and Done was called, your BufSize variable will be filled with value representing total number of bytes actually received.