Private Sub Form_Load()
Dim s As String
s = "abcd"
Open "c:\a.dat" For Output As #5
Print #5, s '写如abcd
Print #5, "" '加个空行
Print #5, s '写如abcd
Close #5
End Sub
Dim o_intFileNum As Integer
Dim o_strLineContent As String
o_intFileNum = FreeFile
Open "c:\abc.txt" For Input As #o_intFileNum
'Do While Not EOF(o_intFileNum) '如果不止一行,请把注释去掉
Line Input #1, o_strLineContent
MsgBox o_strLineContent
'Loop'如果不止一行,请把注释去掉
Close #o_intFileNum
End Sub
Private Sub cmdSave_Click()
Dim o_intFileNum As Integer
o_intFileNum = FreeFile
'Open "c:\abc.txt" For Append As #o_intFileNum '添加模式
Open "c:\abc.txt" For Output As #o_intFileNum '覆盖模式