[求助]文件操作出错
照着书上的例子做,为什么出错了。那位大侠能告诉我为什么啊? <p>怎么没有人帮助啊,大家都没遇到过这问题。</p> 你确定你电脑的C盘Test目录下已经存在Temp.txt这个文件了吗?如果没有请自己创建这个文件然后再运行程序。 <p>当然确定这个文件夹下有这个文件.</p> <p>C:\123 兄弟“\”反了吧。还有应是 AS #1 </p><p>细心点</p> 本帖最后由 作者 于 2007-9-21 15:58:59 编辑 <br /><br /> <p>我改了还是一样的错误。</p><p>Public Sub test()<br/>Open "c:\test\temp.txt" For Append As 1#<br/>Dim a As Integer, b As Integer, c As Integer, d As String<br/>a = 1: b = 2: c = 3: d = "hello"<br/>Write #1, a, b, c, d, "world"<br/>End Sub</p> <p>我试了一下,是没有c:\test这个文件夹</p> <p><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/></p><p>就是错误啊,真的不知道出了什么问题。我有test的这个文件夹啊。</p> <p><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/><img alt="" src="http://www.mjtd.com/bbs/Skins/default/topicface/face13.gif"/></p><p>就是不行啊,我明明有test这个文件夹啊。</p> <p>我改了还是一样的错误。</p><p>Public Sub test()<br/>Open "c:\test\temp.txt" For Append<font color="#ff0033"> As 1# 这样可以吗?感觉是#1吧 </font><br/>Dim a As Integer, b As Integer, c As Integer, d As String<br/>a = 1: b = 2: c = 3: d = "hello"<br/>Write #1, a, b, c, d, "world"<br/>End Sub</p>
页:
[1]
2