Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Gets (downloads) file from FTP server.

 

Syntax

 

n = FTP_GetFile(sFileName, lOptions)

 

Returns

 

Number

A value < 0 indicates an error. Use FTP_GetErrorString(nRet) to get info about the error code

 

Parameters

 

Name

Type

Optional

Meaning

sFileName

String

No

Name of the file to be downloaded.

The file can be also be renamed when it is saved by specifying "oldname:newname" for sFilename

lOptions

Number

No

One of the following two equates indicating download method:

%FTP_SET_SYNC

this option instructs FTP engine to keep control till the file is fully downloaded or an error has occurred
 

%FTP_SET_ASYNC

this option instructs FTP engine to start downloading the file but immediately pass control to the script. In this case programmer is responsible to setup a loop to control download process till file is fully downloaded or an error has occurred
 

 

Remarks

 

Restrictions

 

See also

 

Examples

 

...

'-------------------------------------------------------------------------

'Start DownLoad process Sync mode

'-------------------------------------------------------------------------

'---Sync mode: no way to loop because script execution control

'---will be maintained by FTP_GetFile till download finished or error occurs 

PrintL "---Start downloading in %FTP_SET_SYNC mode----"

FileName = "screen001.jpg"

ftpResult = FTP_GetFile(FileName, %FTP_SET_SYNC)

PrintL "FTP finished is: " + ftpResult

PrintL "----------------------------------------------"

 

'-------------------------------------------------------------------------

'Start DownLoad process Async mode

'-------------------------------------------------------------------------

'---ASync mode: a loop must be setup because script execution control

'---is immediately returned to the script

PrintL "---Start downloading in %FTP_SET_ASYNC mode---"

Dim yPos As Long

FileName = "screen001.jpg"

ftpResult = FTP_GetFile(FileName, %FTP_SET_ASYNC)

PrintL

yPos = Console_GetCursorY

Do

  DoEvents

  PrintAt(FileName & " bytes: " & FTP_GetNumber(%FTP_GET_FILE_BYTES_RCVD), 1, yPos)

Loop while FTP_Finished > 0   ' Loop until end of file reached

 

PrintL "FTP finished is: " + FTP_Finished

PrintL "----------------------------------------------"

...

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software