Sample code for 30+ languages & platforms
Visual FoxPro

Transition from SFtp.ReadDir to SFtp.ReadDirListing

Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loSftp
LOCAL lcHandle
LOCAL loDirObj
LOCAL loDirOut

lnSuccess = 0

loSftp = CreateObject('Chilkat.SFtp')

* ...
* ...

lcHandle = loSftp.OpenDir(".")
* ...
* ...

* ------------------------------------------------------------------------
* The ReadDir method is deprecated:

loDirObj = loSftp.ReadDir(lcHandle)
IF (loSftp.LastMethodSuccess = 0) THEN
    ? loSftp.LastErrorText
    RELEASE loSftp
    CANCEL
ENDIF

* ...
* ...

RELEASE loDirObj

* ------------------------------------------------------------------------
* Do the equivalent using ReadDirListing.
* Your application creates a new, empty SFtpDir object which is passed 
* in the last argument and filled upon success.

loDirOut = CreateObject('Chilkat.SFtpDir')
lnSuccess = loSftp.ReadDirListing(lcHandle,loDirOut)
IF (lnSuccess = 0) THEN
    ? loSftp.LastErrorText
    RELEASE loSftp
    RELEASE loDirOut
    CANCEL
ENDIF

* ...
* ...

loSftp.CloseHandle(lcHandle)

RELEASE loSftp
RELEASE loDirOut