谁有关于用二进制读写文件的代码(图形文件),记得以前有过,找不到....

xayzmb 2003-09-04 03:00:34
多谢!!!!!11
...全文
64 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
null1027 2003-09-05
  • 打赏
  • 举报
回复
我昨天才做好的用二进制发送接受文件的程序。

发送的:
Dim myfile() As Byte
Dim position As Long
Dim FileName As String

FileName = txtaddress.Text
position = FileLen(FileName)
ReDim myfile(position - 1) As Byte

Open FileName For Binary As #1
Get #1, , myfile
Close #1

sockclient.SendData myfile

接受的:
Private lenth As Long '已经收到的数据的长度,再添加时以这个长度为依据

Private Sub sockserver_DataArrival(ByVal bytesTotal As Long)
Dim receivefile() As Byte, i As Long
ReDim receivefile(1 To bytesTotal) '次处也可以是(0 To bytesTotal-1)

sockserver.GetData receivefile, vbArray + vbByte

Open "c:\a.bmp" For Binary As #1
Put #1, lenth + 1, receivefile
Close #1

lenth = lenth + UBound(receivefile) - LBound(receivefile) + 1

txtmessage.Text = txtmessage.Text & Time & "收到数据" & Chr(13) & Chr(10)

End Sub
yunfeng007 2003-09-05
  • 打赏
  • 举报
回复
楼上的真绝!^_^
northwolves 2003-09-04
  • 打赏
  • 举报
回复
'先读后写:

Private Sub Command1_Click()
Dim n As Long
Dim arrBytes() As Byte

Open "c:\xxxx.bmp" For Binary As 1
n = LOF(1)
ReDim arrBytes(1 To n) As Byte
Get 1, , arrBytes
Close 1
Open "c:\temp.bmp" For Binary As 1
Put 1, , arrBytes
Close 1
MsgBox "ok"

End Sub
xayzmb 2003-09-04
  • 打赏
  • 举报
回复
是想将图片转成二进制码再用winsock控件从网上发到客户端
yijiansong 2003-09-04
  • 打赏
  • 举报
回复
根数据库系统有关系的
kmzs 2003-09-04
  • 打赏
  • 举报
回复
http://www.fantasiasoft.net/Source/index.htm
http://www.fantasiasoft.net/FileInfo/index.htm
zhourongbiao 2003-09-04
  • 打赏
  • 举报
回复
帮你up
xayzmb 2003-09-04
  • 打赏
  • 举报
回复
up

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧