How can I read/write file with binary format???

N

NC

I have a problem of read/write binary file.

When I use the following statement


Dim Ar(5) As Byte
Ar(0) = 1
Ar(1) = 3
Ar(2) = 5
Ar(3) = 6
Ar(4) = 7
Open "Test.bin" For Binary Access Write As #1
For i = 0 To 4
Write #1, Ar() ' <--- Error found
Next
Close #1

How can I read/write with binary file???

NC
 
D

DNF Karran

Shouldn't
For i = 0 To 4
Write #1, Ar() ' <--- Error found
Next

be
For i = 0 To 4
Write #1, Ar(i) ' <--- Error found
Next

?

Dunca
 
N

NC

Duncan,

Thanks for your help! This is only typing mistake.

I have found the solution, using Put/Get instead of Write/Input

NC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top