Back to product page

GetDataAt function


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

Type

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

Syntax

  • C
long Sftp_GetDataAt(void *Sftp, char *RemoteFile, __int64 RemotePos, long Size);
The GetDataAt(void *Sftp,char *RemoteFile,__int64 RemotePos,long Size) syntax has these parts:
void *SftpHandle of the created Sftp instance.
char *RemoteFileFull path to a file on the server.
__int64 RemotePos Position in the file at which copying will commence.
long SizeSize 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.

Platforms

Windows