http://www.dreaminco...wtopic21431.htm
Private Function ReadFile(ByVal filePath As String)
Dim fs As IO.FileStream
Dim br As IO.BinaryReader
Dim bytes(10) As Byte
Dim TheFile As String = ""
Dim cutpath() As String = filePath.Split("\")
fs = New IO.FileStream(filePath, IO.FileMode.Open, IO.FileAccess.Read)
br = New IO.BinaryReader(fs)
Dim byteRead As Byte
Dim x As Integer
For x = 0 To br.BaseStream.Length() - 1
byteRead = br.ReadByte
TheFile += CStr(byteRead)
Next
br.Close()
Return "!Binary!" & TheFile & "*" & cutpath(cutpath.Length - 1)
End Function
Private Sub SaveFile(ByVal TheBinaries As String)
'TheBinaires have Data*NameOfFile, this will seperate the two.
Dim TheBin() As String = TheBinaries.Split("*")
Dim fs As IO.FileStream
Dim bw As IO.BinaryWriter
fs = New IO.FileStream("c:\" & "copy_" & TheBin(1), IO.FileMode.CreateNew, IO.FileAccess.Write)
bw = New IO.BinaryWriter(fs)
bw.Write(TheBin(0))
'bw.Write(byteRead)
bw.Flush()
fs.Close()
bw.Close()
End Sub
The "!Binary!" is there to tell my program call SaveFile. It gets pulled out before writing to the file though.

New Topic/Question
Reply




MultiQuote




|