📄 fce4vb_r.txt
字号:
'close connection.
Code = fceClose(0)
'release FCE
Code = fceRelease()
ALSO SEE "Theory of Operation" in Users Manual (FCE4VB_U.TXT).
FCE4VB Reference Manual Page 9
+--------------+----------------------------------------------------+
| fceErrorText | Formats an error message. |
+--------------+----------------------------------------------------+
SYNTAX Declare Function fceErrorText(
ByVal Chan As Long, 'channel number
ByVal Code As Long, 'Error code
ByVal Buffer As String, 'location to put error message
ByVal BufLen As Long) 'size of above
REMARKS The fceErrorText function formats the error message for
error 'Code' in 'Buffer'.
Call this function when an error (a negative value) is
returned from a FCE function so that the error message can
be displayed or logged.
RETURNS The number of characters copied to 'Buffer'.
EXAMPLE
Dim Buffer As String * 100
Code = fceConnect(...)
If Code < 0 Then
'display error message
N = fceErrorText(0,Code,Buffer,100)
If N > 0 then
PRINT "ERROR " + Left$(Buffer,N)
End If
End If
ALSO SEE
FCE4VB Reference Manual Page 10
+------------+------------------------------------------------------+
| fceExtract | Extracts strings from FTP formatted file list. |
+------------+------------------------------------------------------+
SYNTAX Declare Function fceExtract(
ByVal Buffer As String, 'buffer returned by fceGetList.
ByVal LineNbr As String, 'line number [1,2,...] wanted.
ByVal FieldNbr As String, 'field number [1,2,...] wanted.
ByVal BufPtr As String, 'Resultant buffer.
ByVal BufLen As Long) 'Size of above.
REMARKS The fceExtract function extracts fields from FTP formatted
file lists for line 'LineNbr' and field 'FieldNbr'. The
extracted substring is copied into 'BufPtr'. Use 'FieldNbr'
0 in order to copy the entire line rather than a field.
A typical line in a full FTP directory listing may look
like the following. Note that there are 9 fields.
-rw-r--r-- 1 345 15 100424 Feb 8 16:26 fce4c10b.zip
Note that in the line above, field 5 is the file length.
The fceExtract function is typically called after calling
fceGetList.
RETURNS The number of characters copied to 'BufPtr'.
EXAMPLE
Dim Line As Long
Dim Code As Long
Dim LineBuf As String * 100
' ask for full list
Code = fceGetList(0,FCE_FULL_LIST,DataBuffer,MAX_BUF)
If Code < 0 Then
Call DisplayError(Code)
Exit Function
End If
' get each field for line 8
Line = 8
For I = 1 To 9
Code = fceExtract(DataBuffer,Line,I,LineBuf, 100)
PRINT "FIELD " & Str$(I) & " [" & LineBuf & "]"
End If
Next I
ALSO SEE fceGetList
FCE4VB Reference Manual Page 11
+------------+------------------------------------------------------+
| fceGetFile | Gets (downloads) file from FTP server. |
+------------+------------------------------------------------------+
SYNTAX Declare Function fceGetFile(
ByVal Chan As Long, ' channel number
ByVal FileName As String) ' Name of file to download
REMARKS The fceGetFile function is used to download the file
'FileName' from the FTP server.
Note that ASCII transfer mode is normally the default. Call
fceSetMode(Chan,ASC("B")) to set the transfer mode to
binary for non ASCII files.
RETURNS < 0 : An error has occurred. Call fceErrorText.
EXAMPLE
' Attach FCE
Code = fceAttach(1, FCE_KEY_CODE)
If Code < 0 Then
PRINT "Cannot attach FCE"
Exit Function
End If
' Connect to FTP server
Code = fceConnect(0,"ftp.hiwaay.net","ftp","you@isp.com")
If Code < 0 Then
Call DisplayError(Code)
Exit Function
End If
' download file
Code = fceGetFile(0,"PRODUCTS.TXT")
If Code >= 0 Then
PRINT "File downloaded"
End If
' close connection.
Code = fceClose(0)
' release FCE
Code = fceRelease()
ALSO SEE fcePutFile
FCE4VB Reference Manual Page 12
+---------------+---------------------------------------------------+
| fceGetInteger | Returns numeric parameter. |
+---------------+---------------------------------------------------+
SYNTAX ULONG fceGetInteger(
ByVal Chan As Long, ' channel number
ByVal ParamName As Long) ' Parameter name
REMARKS The fceGetInteger function returns the value of the
specified parameter 'ParamName'.
Note that the return type is unsigned long.
FCE_GET_VERSION : Returns FCE version.
FCE_GET_BUILD : Returns FCE build number.
FCE_GET_SOCK_ERROR : Returns last socket error code.
FCE_GET_SOCKET : Returns control socket number.
FCE_GET_COUNTER : Returns # times FCE driver was called.
FCE_GET_RESPONSE : Returns last FTP response.
FCE_GET_FILE_BYTES_RCVD : Returns # file bytes received.
FCE_GET_TOTAL_BYTES_RCVD : Returns total bytes received.
FCE_GET_FILE_BYTES_SENT : Returns # file bytes sent.
FCE_GET_TOTAL_BYTES_SENT : Returns total file bytes sent.
FCE_GET_CONNECT_STATUS : Returns 1 if connected.
RETURNS Value of parameter requested.
EXAMPLE
' display FCE version number.
Dim Version As Integer
Dim S1, S2 As String
Version = fceGetInteger(0, FCE_GET_VERSION)
S1 = Hex$(Version)
S2 = Mid$(S2, 1, 1) + "." + Mid$(S2, 2, 1) + "."
+ Mid$(S2, 3, 1)
Print "FCE4VB version " + S2
ALSO SEE fceGetString
FCE4VB Reference Manual Page 13
+------------+------------------------------------------------------+
| fceGetList | Gets file list from FTP server. |
+------------+------------------------------------------------------+
SYNTAX Declare Function fceGetList(
ByVal Chan As Long, ' channel number
ByVal Flag As Long, ' FULL or NAME list flag.
ByVal Buffer As String, ' List buffer.
ByVal BufLen As Long) ' size of 'Buffer'
REMARKS The fceGetList function downloads the directory list from
the FTP server.
If 'FCE_FULL_LIST' is passed for 'Flag', a full directory
listing is returned in 'Buffer'. Note that the exact format
of the list depends on the particular FTP server.
If 'FCE_NAME_LIST' is passed for 'Flag', a listing is
returned consisting of file names only. Note that some FTP
servers do not support the name list function.
If 'FCE_FULL_LIST_FILE' is passed for 'Flag', the filename
to list is taken from 'Buffer'. If the file exists, a
listing of this file is returned.
If 'FCE_NAME_FULL_LIST_FILE' is passed for 'Flag', the
filename to list is taken from 'Buffer'. If the file
exists, a the name of this file is returned. Be sure to
check the return code length.
File lists consist of a zero terminated list of file
entries, each of which is terminated by a carriage return,
line feed pair. Also check the return code, which contains
the length of the characters placed in 'Buffer'.
RETURNS < 0 : An error has occurred. Call fceErrorText.
>= 0 : Number of characters copied to 'Buffer'.
EXAMPLE
Dim Buffer As String * 5000
...
' get file name list
Code = fceGetList(0,FCE_LIST_NAME,Buffer,5000)
If Code > 0 Then
PRINT Left$(Buffer, Code)
Else
PRINT "Not found."
End If
ALSO SEE fceExtract.
FCE4VB Reference Manual Page 14
+----------------+--------------------------------------------------+
| fceGetLocalDir | Returns the local upload/download directory. |
+----------------+--------------------------------------------------+
SYNTAX Declare Function fceGetLocalDir(
ByVal Chan As Long, ' channel number
ByVal Buffer As String, ' string buffer
ByVal BufLen As Long) ' size of 'Buffer'
REMARKS The fceGetLocalDir function returns the local
upload/download directory.
The local upload/download directory is the directory used
for all uploads and downloads. The default is the current
directory (".").
Both relative and absolute directories may be specified.
RETURNS < 0 : An error has occurred. Call fceErrorText.
>= 0 : The number of characters copied.
EXAMPLE
' Set local upload/download directory.
Code = fceSetLocalDir(0,"DOWNLOADS\TEXT")
ALSO SEE fceSetLocalDir
FCE4VB Reference Manual Page 15
+-----------------+-------------------------------------------------+
| fceGetServerDir | Returns the FTP server directory. |
+-----------------+-------------------------------------------------+
SYNTAX Declare Function fceGetServerDir(
ByVal Chan As Long, ' channel number
ByVal Buffer As String, ' string buffer
ByVal BufLen As Long) ' size of 'Buffer'
REMARKS The fceGetServerDir function returns the FTP server
directory.
Note that most all FTP servers will restrict clients as to
which directories on the server that can be accessed.
The default is the current logged directory on the FTP
server.
RETURNS < 0 : An error has occurred. Call fceErrorText.
>= 0 : The number of characters copied.
EXAMPLE
Dim Buffer As String * 65
' copy directory string to 'Buffer'
Code = fceGetServerDir(0, Buffer, 65)
PRINT "Server directory is " + Left$(Buffer,Code)
ALSO SEE fceSetServerDir
FCE4VB Reference Manual Page 16
+------------------+------------------------------------------------+
| fceMakeServerDir | Creates server directory. |
+------------------+------------------------------------------------+
SYNTAX Declare Function fceMakeServerDir(
ByVal Chan As Long, ' channel number
ByVal DirName As String) ' Name of directory to make
REMARKS The fceMakeServerFile function is used to make (create)
server directory 'DirName' on the FTP server.
The make may fail if you don't have the necessary
permission, as is typical when you connect as an anonymous
user.
RETURNS < 0 : An error has occurred. Call fceErrorText.
EXAMPLE
' Attach FCE
Code = fceAttach(1, FCE_KEY_CODE)
If Code < 0 Then
PRINT "Cannot attach FCE"
Exit Function
End If
' Connect to FTP server
Code = fceConnect(0,"ftp.yourisp.com", "user", "password")
If Code < 0 Then
Call DisplayError(Code)
Exit Function
End If
' create new directory
Code = fceMakeServerDir(0,"MYSTUFF.DIR")
' close connection.
Code = fceClose(0)
' release FCE
Code = fceRelease()
ALSO SEE fceDelServerDir
FCE4VB Reference Manual Page 17
+--------------+----------------------------------------------------+
| fceGetString | Returns string parameter. |
+--------------+----------------------------------------------------+
SYNTAX Declare Function fceGetString(
ByVal Chan As Long, ' channel number
ByVal ParamName As String, ' parameter name
ByVal Buffer As String, ' string buffer
ByVal BufLen As String) ' size of 'Buffer'
REMARKS The fceGetString function returns the string parameter
'ParamName'.
FCE_GET_REGISTRATION : Returns registration string.
FCE_GET_LAST_RESPONSE : Returns last FTP response.
FCE_GET_SERVER_IP : Returns IP address of FTP server.
RETURNS < 0 : An error has occurred. Call fceErrorText.
>= 0 : Number of characters copied to 'Buffer'.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -