login about faq

When i tried to read a 9 megabyte text file from SFTP server using sftp.ReadFileText32 only 65535 characters were returned ? Why's that ? I just tried sample from chilkat site. http://www.example-code.com/vbdotnet/sftp_readTextFile.asp

Thanks

asked Aug 08 '13 at 16:15

amidar's gravatar image

amidar
1111


I tested the same, but did not reproduce the problem. Verify that the problem still exists in the very latest version of Chilkat. If so, then post the contents of the LastErrorText captured after the call to ReadFileText32.

link

answered Aug 09 '13 at 10:19

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

I'll verify with the very last version but, in the meantime i just found simple solution for this problem.

This is the original way to read text file :

Dim charset As String
charset = "ansi"
Dim offset32 As Long
offset32 = 0
sFileContent = sftp.ReadFileText32(handle, offset32, numBytes, charset)
If (sFileContent = vbNullString) Then
    MsgBox(sftp.LastErrorText)
    Exit Function
End If

And this is modified way to do the same thing but this time reading whole file.

Dim charset As String
charset = "ansi"
Dim offset32 As Long
offset32 = 0
sFileContent = ""
Do
    sFileContent = sFileContent & sftp.ReadFileText32(handle, offset32, numBytes, charset)
    If (sFileContent = vbNullString) Then
        MsgBox(sftp.LastErrorText)
        Exit Function
    End If
    offset32 = sFileContent.Length
Loop Until sftp.Eof(handle)

Hope this simple modification will help someone else with the same problem.

link

answered Aug 09 '13 at 18:24

amidar's gravatar image

amidar
1111

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×200
×1

Asked: Aug 08 '13 at 16:15

Seen: 696 times

Last updated: Aug 09 '13 at 18:24

powered by OSQA