Visual Basic 6清除文本文件中的内容而不引用库6

Dav*_*son 2 vb6

我想知道如何使用VB6删除文本文件中的所有内容,而无需添加对任何对象库的引用.不幸的是,我所知道的是如何打开它:

Open App.Path & "/media/text.txt" For Input As #1
Run Code Online (Sandbox Code Playgroud)

谢谢.

ren*_*ene 10

Dim intFile As Integer

intFile = FreeFile

Open App.Path & "/media/text.txt" For Output As #intFile
Close #intFile
Run Code Online (Sandbox Code Playgroud)

作为quickref

  • 显然,+1,但不要硬编码文件句柄 (2认同)