Ftp Read
This command reads data from a file on a remote FTP site.
If the number of bytes to read is omitted, then up to 32K will be read. The maximum number of bytes that can be read is 64 kilobytes.
You must first establish an FTP connection
using the Ftp Connect, Ftp Connect2, Ftp
ConnectSFTP, or Ftp ConnectFTPS command, and you must open the file
using the Ftp Open command.
The file data conversions are useful for manipulating files containing binary data, especially nulls such as character zeroes.
The Unicode character set has two bytes per character, so each byte of data read is placed in the low-byte of a character to make it backward compatible with previous releases.
Syntax
Ftp Read variable, [bytes], [options]
Synonyms
FTP RD
Parameters
The following table describes the parameters of the Ftp Read command:
| Parameter | Description |
|---|---|
| variable | The name of the variable into which data will be read |
| bytes | The number of bytes to read; if the number of bytes to read is omitted, then up to 32K will be read |
| options | See the following table |
Values for options
| Value | Description |
|---|---|
| 0 | No conversion (default) |
| DF_BS (1) | Convert data to backslash format |
| DF_HEX (2) | Convert data to 2-character hex format |
| DF_FT (3) | Convert data to File Transfer format |
Examples
The following example reads in names from the remote data file.
Ftp Open "people", 0, Response
If Response Then
MessageBox Response
Else
Ftp Read PeopleData
MessageBox PeopleData
Ftp Close
EndIfRelated Script Commands
Ftp Close, Ftp Connect, Ftp Connect2, Ftp Connect, FTPS, Ftp ConnectSFTP, Ftp Open, Ftp Write
Version
4.0.1 Original version
5.2 Unicode notes