互相有逗号分隔。
“This is a test about file”,"Visual ", "Basic ", "&
","Computer"
8.2.2 顺序文件的写操作
3.向文件追加数据 如果要在原有数据文件中增加数据,应使用Append
方式打开文件,数据被添加在文件尾部。 注意:在Output方式下进行写操作时,新的数据是
运行结果: There are some data about employeeId in the file:100,101,260,500,999
8.2.3 顺序文件的读操作
对同样的数据,使用Input语句读数据:
Private Sub Command1_Click() Dim s1 As String, s2 As String Open "c:\d3.dat" For Input As #3 Line Input #3, s1 Line Input #3, s2 Ptint s1, s2 Close #3 End Sub
执行以上过程后在窗体上显示出以下内容:
There are some data about employeeId in the file:100
8.2.3 顺序文件的读操作
观察:
看到第一条记录被完整读入,而第2条记录只读入 第1个数。
原因:
用Input语句进行读入操作时,当遇到逗号或记录尾时 就认为一个字符串结束,除非字符串用双引号括起来。
在输出的数据后面自动加上一个记录结束标 志,表示本记录“到此为止”,其后是下一 记录的数据。
8.2.2 顺序文件的写操作 2.用Write语句向文件写数据 用Write语句向文件写数据时,能自动地在各