David,
If you are operating strictly byte reads & writes all you need is Stream or
FileStream.
I would use something like:
Dim inputPath As String
Dim outputPath As String
Dim input As New FileStream(inputPath, FileMode.Open,
FileAccess.Read)
Dim output As New FileStream(outputPath, FileMode.Create,
FileAccess.Write)
Dim count As Integer = 1024
Dim buffer(count - 1) As Byte
count = input.Read(buffer, 0, count)
Do Until count = 0
' modify each byte in buffer here
output.Write(buffer, 0, count)
count = input.Read(buffer, 0, count)
Loop
input.Close()
output.Close()
StreamReader & StreamWriter are more useful when you want to translate a
text stream to/from "primitive" values, such as Integer, Double, and String.
BinaryReader & BinaryWriter are useful when you want to translate a binary
stream to/from "primitive" values, such as Integer, Double, and String.
Hope this helps
Jay
"David Buchan" <pd******@yahoo.com> wrote in message
news:d4**************************@posting.google.c om...
Hello,
I wonder if anyone could help me.
I'm using vb.NET and I'd like to read a binary file, byte by byte, and
then write to another file (making a duplicate, identical file).
I'd then like to modify the program to take the integer value of each
byte and say, add or subtract an integer from it, with the result
still being an integer from 0 to 255. Then write another file that is
just a list of the integers (as a column of numbers).
I think that vb6 allowed the use of GET and PUT, but I don't think
vb.NET allows those anymore. I believe I have to use the methods of
streamReader and streamWriter to accomplish the task, but I don't know
how.
Thanks,
Dave