Archived Forum Post

Index of archived forum posts

Question:

How to read a csv file from the Linux Server

Sep 22 '14 at 12:00

I have to read a CSV file row by row which is located in the Linux Server.

From the Sample code : http://www.example-code.com/vbdotnet/sftp_readTextFile.asp
I am able to read the file in the SFTP server. In the sample code, they have mentioned the bytes for each row to read.

 '  Open a file for reading.

            handle = sftp.OpenFile(_fileName, "readOnly", "openExisting")
            If (handle = vbNullString) Then
                MsgBox(sftp.LastErrorText)
                Exit Function
            End If

            '  Assume the file we are reading contains the following text:
            '  abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
            '  (in ANSI format -- i.e. one byte per char).

            '  Read 26 bytes:
            Dim sText As String
            sText = sftp.ReadFileText(handle, 26, "ansi")
            If (sText = vbNullString) Then
                MsgBox(sftp.LastErrorText)
                Exit Function
            End If

In my scenario, I have to use End of File. How to alter the code to read end of the line. This will help to solve the issue.