需要引入命名空间
imports System.IO
'二进制流 转文件
Public Function BinaryTofile(ByVal byTmp As Byte(),ByVal path As String) As Boolean
Dim fs As fileStream
Dim bwr As BinaryWriter
fs = New fileStream(path,fileMode.Create)
bwr = New BinaryWriter(fs)
bwr.Write(byTmp)
bwr.Flush()
bwr.Close()
fs.Close()
fs.dispose()
Return True
End Function
'文件转二进制流,读取文件二进制流
Public Function fileToBinary(ByRef byTmp As Byte(),ByVal path As String) As Boolean
Dim fs As fileStream
Dim br As BinaryReader
fs = New fileStream(path,fileMode.Open,fileAccess.Read)
br = New BinaryReader(fs)
byTmp = br.ReadBytes(fs.Length)
br.Close()
fs.Close()
fs.dispose()
Return True End Function
总结以上是内存溢出为你收集整理的读写二进制文件 VB.NET全部内容,希望文章能够帮你解决读写二进制文件 VB.NET所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)