Back to product page

GetData function


Retrieves the contents of a remote file to a string variable

Type

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

Syntax

  • C
long Sftp_GetData(void *Sftp, char *RemoteFile);
The GetData(void *Sftp,char *RemotePath) syntax has these parts:
void *SftpHandle of the created Sftp instance.
char *RemotePathFull path to a file on the server.

Remarks

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

As the GetData 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).

Platforms

Windows