wodSFTP API library - GetData Method
      
 

Description

Retrieves the contents of a remote file to a string variable


Return type

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


Syntax

long Sftp_GetData(void *Sftp, char *RemoteFile);

The GetData function syntax has these parts:

Part Description
void *Sftp Handle of the created Sftp instance.
char *RemoteFile Full path to 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).