用VB6.0删除文本文档内的回车换行符

2025-03-05 12:44:24
推荐回答(1个)
回答1:

Private Sub Command1_Click()
Dim str As String, x As String
Open "c:\123456.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, x
str = str + x
Loop
Close
Open "c:\123456.txt" For Output As #1
Print #1, str
Close
MsgBox "完成了!", vbOKOnly, "提示"
End Sub
注:我的代码中的文件在C盘,名称为123456.txt,把这些换成你的文件路径就行了。
我已经验证,正确运行。