Reads data from a previously opened file on a remote server.
WebAPI.bdh
WebFtpReadFile( in hFtp : number, out sData : string, in nMaxData : number, out nRead : number ): boolean;
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. |
sData |
Buffer to store the received data. Make sure to set nMaxData <= size of sData |
nMaxData |
Maximum amount of data to read from server. Make sure to set nMaxData <= size of sData |
nRead | Variables that receives the number of bytes read |
dcltrans transaction TReadFile var hFtp : number; sData : string(5000); nData : number; // number of bytes read begin WebFtpConnect(hFtp, "localhost", WEB_PORT_FTP, "user", "pass"); WebFtpOpenFile(hFtp, "testfile.txt", false, false); WebFtpReadFile(hFtp, sData, STRING_COMPLETE, nData); write(sData); writeln; WebFtpCloseFile(hFtp); WebFtpShutdown(hFtp); end TReadFile;