Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
InternetFileRead Returns 0 instead of T/F
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00447557
Message ID:
00447630
Views:
7
>Here is my code and at the button my questions
>
>I Have:
>
>******INSIDE MY.Prg***********
>
>lnPktSize = 100
>lnBytesRead = 0
>FOR x=1 to 5
> lcReadBuffer=SPACE(100)
> bOk=oFTP.FtpReadXBytes(Handle,lcReadBuffer,lnPktSize,lnBytesRead)
> lnBytesRead=lnBytesRead+lnPktSize
>ENDFOR
>
>******INSIDE FTPClass.prg******
>
>LOCAL lcReadBuffer,lnBytesToRead,lnBytesRead
>
>DECLARE INTEGER InternetReadFile IN WinInet ;
> INTEGER nConnect_Handle, STRING @lcReadBuffer,INTEGER lnBytesToRead,INTEGER @lnBytesRead
>
>PROCEDURE FtpReadXBytes
>LPARAMETERS nHandle,cReadBuffer,nPktSize,nBytesRead
>LOCAL nReadOk
>IF THIS.OpenFtpConnection()
> nReadOK = InternetReadFile(nHandle,@cReadBuffer,nPktSize,@nBytesRead)
> THIS.GetExtendedError()
> THIS.CloseFtpConnection()
> RETURN nReadOk
>ELSE
> MESSAGEBOX("Not connected!!!")
> RETURN .F.
>ENDIF
>ENDPROC
>
>But:
>
>1- InternetReadFile Return 0 instead of .T. or .F.

Zero = Boolean false. Use
nReadOK = (InternetReadFile(nHandle, @cReadBuffer, nPktSize, @nBytesRead) # 0)
To get a Boolean value.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform