wodSFTP API library - GetDataAt Method
      
 

Description

Retrieves the contents of a remote file to a string variable, starting from a given position.


Return type

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


Syntax

long Sftp_GetDataAt(void *Sftp, char *RemoteFile, __int64 RemotePos, long Size);

The GetDataAt 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.
__int64 RemotePos Position in the file at which copying will commence.
long Size Size of the data to copy locally.

Remarks
Unlike the GetFileAt method which copies part of a file from a remote server to a local file, GetDataAt will get part of the file from the server and copy it to the String variable. When everything is complete and the Done callback has fired (as for all other methods), the ListItem property will hold the retrieved data.

As the GetDataAt method creates a temporary file on your local disk, you should ensure that wodSFTP has sufficient privileges to create such files. In environments like ASP (Active Server Pages), wodSFTP is running as the guest user and may not have enough privileges to create a file on the local disk. In this case, the operation will fail with an error (Could not create temporary file).

If you want to copy data to a buffer that you allocate, you can use the GetDataToBuffer or GetDataToBufferAt functions.