Back to product page

GetDataToBuffer function


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

Type

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

Syntax

  • C
long Sftp_GetDataToBuffer(void *Sftp, char * RemoteFile, char *Buffer, int BufSize);
The GetDataToBuffer(void *Sftp,char *RemoteFile,char *Buffer,int *BufSize) syntax has these parts:
void *SftpHandle of the created Sftp instance.
char *RemoteFileFull path to a file on the server.
char *BufferPointer to an allocated buffer where data will be stored.
int *BufSizePointer 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.

Platforms

Windows