Binary read in VB 6.0

Hello Experts,
For the past few questions, I have not been successful at getting a solution, however, I really need an answer to this. I have this code in VB.NET:
            Dim fs As FileStream
            Dim r As BinaryReader
            Dim addDocBytes() As Byte
            Dim bytesWritten As Integer
            fs = New System.IO.FileStream(filePath, System.IO.FileMode.Open)
            r = New System.IO.BinaryReader(fs)
            addDocBytes = r.ReadBytes(fs.Length)

I need to get its equivalence in VB 6.0. The reason is that LotusScript within Lotus Notes is VB 6.0 like, and is not up to speed with dot net.

Your help will be greatly appreciated.
BMaadaraniAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BMaadaraniAuthor Commented:
I have no idea why I am faced with this. But if to submit I need to add a comment, why not..
0
devhelperCommented:
Please check the following link which might help you:
http://www.vb-helper.com/howto_read_write_binary_file.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
danaseamanCommented:
Try this:

Option Explicit

Private Sub Form_Load()
    Dim b() As Byte
    Dim i   As Long
    
    b = GetBytes(App.Path & "\sample.txt")
    For i = 0 To UBound(b)
       Debug.Print b(i) & " ";
    Next
End Sub

Function GetBytes(ByVal sFileName As String) As Byte()
   Dim b() As Byte
   Dim FF As Integer
   
   On Error Resume Next
   FF = FreeFile
   Open sFileName For Binary Access Read As FF
   ReDim b(LOF(FF) - 1)
   Get FF, , b
   Close FF
   GetBytes = b
End Function

Open in new window

0
BMaadaraniAuthor Commented:
Great, both references worked great. Thank you very much.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.