SFTP ReadFileBytes not returning all the data?

Question:

I’m just beginning to work with some of the Chilkat components and I’ve
run into an apparent issue with the ReadFileBytes method in the
ChilkatSFtp component.

I’m attempting to read an entire file using ReadFileBytes and only
getting part of the file. Here’s essentially what I’m doing:

* Use GetFileSize32 to get the size of the file (returns 168914)
* Use ReadFileBytes passing in that length (168914) as the number
of bytes

The result is that I get 50000 bytes.
Is there a 50000 byte limit in ReadFileBytes?

Answer:

The 2nd argument to ReadFileBytes is the maximum number of bytes you want to read.
The method may return with a lesser number of bytes. To read the entire file, you would call ReadFileBytes repeatedly until you reach the EOF.

(See the reference documentation at http://www.chilkatsoft.com/refdoc –> “To read an entire file, one may call ReadFileBytes repeatedly until Eof(handle) returns true.” )

Tags :