Compile error calling ReadFile from Delphi 2007
Posted: Thu 13 Oct 2016 20:56
We have a Delphi 2007 program that used SecureBridge 2.6.
When we install SecureBridge 7.0.1 or 7.1.2, and try to compile our program, we get the error:
'There is no overloaded version of 'ReadFile' that can be called with these arguments.'
The offending code looks like this:
h: TScSFTPFileHandle;
buf: array [0..32767] of byte;
count: integer;
pos: int64;
begin
fs := TFileStream.Create(LocalFilename, fmCreate);
try
h := FFTPCli.OpenFile(RemoteFilename, fmOpenExisting);
pos := 0;
count := FFTPCli.ReadFile(h, pos, buf, SizeOf(buf));
It looks like an overload of ReadFile may have been removed in these versions.
I tried changing the call to use the other overload, the one that requires the offset, like this:
count := FFTPCli.ReadFile(h, pos, buf, 0, SizeOf(buf));
But that gets the same error.
Do you have an example of Delphi code that would work with this function now? Or know what I can do to fix the original issue?
Thanks.
When we install SecureBridge 7.0.1 or 7.1.2, and try to compile our program, we get the error:
'There is no overloaded version of 'ReadFile' that can be called with these arguments.'
The offending code looks like this:
h: TScSFTPFileHandle;
buf: array [0..32767] of byte;
count: integer;
pos: int64;
begin
fs := TFileStream.Create(LocalFilename, fmCreate);
try
h := FFTPCli.OpenFile(RemoteFilename, fmOpenExisting);
pos := 0;
count := FFTPCli.ReadFile(h, pos, buf, SizeOf(buf));
It looks like an overload of ReadFile may have been removed in these versions.
I tried changing the call to use the other overload, the one that requires the offset, like this:
count := FFTPCli.ReadFile(h, pos, buf, 0, SizeOf(buf));
But that gets the same error.
Do you have an example of Delphi code that would work with this function now? Or know what I can do to fix the original issue?
Thanks.