【VB开源代码栏目提醒】:以下是网学会员为您推荐的VB开源代码-Ex14_8.frm,希望本篇文章对您学习有所帮助。
VERSION 5.00
Begin VB.Form Ex14_8
Caption = "读写二进制文件"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
End
Attribute VB_Name = "Ex14_8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Click()
Dim i, j, FileNumber
FileNumber = FreeFile '获得尚未被占用的文件号中的第一个
Open "rest.dat" For Binary As FileNumber '打开文件
i = "读写二进制文件"
j = "Visual Basic的程序设计"
Put #FileNumber, 800, i '文件写数据
Put #FileNumber, 1200, j
Get #FileNumber, 800, i '文件中指定位置的数据
Get #FileNumber, 1200, j
Print
Print i '向窗体打印数据
Print j
Close #FileNumber
End Sub