google搜索 51Testing站内搜索                    软件测试门户 | 软件测试培 训 | 文章资料精选 | 软件测试论坛 | 软件测试博客 | 测试招聘求职 
打印

为什么运行时提示没有权限?请高手指教

为什么运行时提示没有权限?请高手指教


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", 有高手可以指导一下吗?万分感激

TOP

当前登陆用户权限问题??

TOP

回复 #2 5am 的帖子


可是如果只是运行
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."

弄得我有点晕了...

TOP

 
当前时区 GMT+8, 现在时间是 2008-10-8 16:12Copyright(C)上海博为峰软件技术有限公司 2001-2007 电话:021-64471599-8017
当您在访问网站、论坛及博客过程中遇到问题时可发送email:webmaster@51testing.com或发送论坛短信至管理员风在吹