Declare Sub createfile()
Sub main
Dim filemode as Integer
Dim attrib as Integer
Call createfile
attrib=1
filemode=FileAttr(1,attrib)
If filemode=1 or 2 then
MsgBox "File was left open. Closing now."
Close #1
End If
Kill "C:\TEMP001"
End Sub
Sub createfile()
Rem Put the numbers 1-10 into a file
Dim x as Integer
Open "C:\TEMP001" for Output as #1
For x=1 to 10
Write #1, x
Next x
End Sub
当程序运行到Open "C:\TEMP001" for Output as #1时就有提示说"Permision Denied", 有高手可以指导一下吗?万分感激
可是如果只是运行
Sub main
Rem Put the numbers 1-10 into a file
Dim x as Integer
Open "C:\TEMP001" for Output as #1
For x=1 to 10
Write #1, x
Next x
End Sub
是可以把数据输入文件中的, 只有全部代码一起运行的情况下会发生这种情况.
而且文件关闭的情况下反而会输出"File was left open. Closing now."