EOF does not reset

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
HBL
Posts: 4
Joined: Wed 24 Oct 2018 06:04

EOF does not reset

Post by HBL » Wed 14 Nov 2018 13:49

When I try to open a file, then read it and close it using closehandle. If I then try to open another file or the same file, then EOF is not set to false, but stays at True from last time.

System: Delphi XE5 Update 2, Windows 10 Pro, SecureBridge 8.2.4

I even tried to disconnect and reconnect without it being reset to false when I call Openfile.

Code:
var
Handle: TBytes;
Begin
ScSFTPClient1.connect;

For I := 0 to 5 do Begin //Loop, just for testing
Handle := ScSFTPClient1.OpenFile('/test/2018-01-05_panelists.txt', fmOpenExisting, [], [bmWrite, bmDelete], [amReadData]);
Try
//First time ScSFTPClient1.EOF is False, second time it stays True and the code inside While is not executed.
While not ScSFTPClient1.EOF do
//Do ScSFTPClient1.ReadFile here
Finally
CloseHandle(Handle);
end;
end;

ScSFTPClient1.Disconnect;
Anyone have solution to this, its a pretty wierd if no one have seen it before ?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: EOF does not reset

Post by ViktorV » Wed 14 Nov 2018 14:40

To solve your task, please try to use the following code:

Code: Select all

repeat
//Do ScSFTPClient1.ReadFile here
until ScSFTPClient1.EOF;
instead of

Code: Select all

While not ScSFTPClient1.EOF do
//Do ScSFTPClient1.ReadFile here

HBL
Posts: 4
Joined: Wed 24 Oct 2018 06:04

Re: EOF does not reset

Post by HBL » Thu 15 Nov 2018 07:51

I got it working using the Repeat sentence

I see now that the EOF flag is set by ReadFile, so by checking it on second loop before Readfile will always yell True because of the previous loop.

Idea:
Would it be better if the call to OpenFile resets the flag to False, so both While and Repeat would work?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: EOF does not reset

Post by ViktorV » Thu 06 Dec 2018 14:43

We have already fixed this issue, the fix will be included in the next SecureBridge build, which we are planning to release within a week.

Post Reply