Private Sub Command1_Click()
Dim f(1 To 3), b, c, d
f(1) = "c:\a\"
f(2) = "c:\b\"
f(3) = "c:\c\"
For i = 1 To 3
a = files(f(i) & "\*.*")
If a <> "" Then
Open f(i) & a For Input As #1
d = d & StrConv(InputB(LOF(1), 1), vbUnicode)
Close #1
End If
Next
If d <> "" Then
Open "c:\d\" & Int(Timer) & ".txt" For Output As #1
Print #1, d
Close #1
End If
MsgBox "ok"
End Sub
Function files(ByVal cp As String) As String
Dim pp() As String, p As String, x As Integer
ReDim Preserve pp(0)
Randomize Timer
p = Dir(cp)
Do While p <> ""
ReDim Preserve pp(UBound(pp) + 1)
pp(UBound(pp)) = p
p = Dir()
Loop
If UBound(pp) > 0 Then files = pp(Int(1 + Rnd * UBound(pp)))
End Function
6如表-中的“身份证号”字段。.. 文件的种类和存取类型 vb有三种文件:顺序文件、随机文件和二进制文件。访问一个顺序文件时,通常是三个步骤:打开文件(若此文件不存在,则要建立一个新的文件)、读取/写入数据、关闭文件拜旺掎R