WebFtpCloseFile Function

Action

Closes a file handle previously opened with WebFtpOpenFile.

Include file

WebAPI.bdh

Syntax

WebFtpCloseFile(in hFtp: number): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hFtp

Valid handle to an FTP session. This handle must have been returned from a previous call to WebFtpConnect.

Beside that, the file must have been opened using WebFtpOpenFile.

Example

dcltrans 
  transaction TWriteFile 
  var 
    hFtp : number; 
    sData : string(50); 
    nData : number; // number of bytes written 

  begin 
    sData := "Hello world!"; 
    WebFtpConnect(hFtp, "localhost", WEB_PORT_FTP, "user", "pass"); 
    WebFtpOpenFile(hFtp, "testfile.txt", false, true); 
    WebFtpWriteFile(hFtp, sData, Strlen(sData), nData); 
    write(nData);
    writeln(" bytes written"); 
    WebFtpCloseFile(hFtp); 
    WebFtpShutdown(hFtp); 
  end TWriteFile;