Im currently trying to develop some kind of file-transfer tool.
so i have to read a file completely in binary mode, transfer it, and write it again on the other computer.
but i have the following problem: how do i know when the filestream ends?
this code is working, but i am looking for a "better" one:
has anyone suggestions?
thanks,
Cyrus
so i have to read a file completely in binary mode, transfer it, and write it again on the other computer.
but i have the following problem: how do i know when the filestream ends?
this code is working, but i am looking for a "better" one:
Code:
Private Sub ReadWrite()
Dim Input As New System.IO.BinaryReader(New IO.FileStream("d:\auth.dll", IO.FileMode.Open))
Dim Output As New System.IO.BinaryWriter(New IO.FileStream("d:\auth2.dll", IO.FileMode.Create))
Dim t As Byte
While True
Try
t = Input.ReadByte
Output.Write(t)
Catch ex As System.IO.EndOfStreamException
Exit While
End Try
End While
Input.Close()
Output.Close()
End Sub
has anyone suggestions?
thanks,
Cyrus