谁能帮我来解决这个读写文件的问题啊

wyp2120 2006-11-18 09:24:44
str1 = "嘿嘿"
str2 = "小心哈"
str3 = "哦豁"
Open App.Path & "\" & "wyp.txt" For Output As #1
Print #1, str1, str2, str3
Close #1

Open App.Path & "\" & "wyp.txt" For Input As #1
While Not EOF(1)
Input #1, str1, str2, str3
Wend
Close #1
为什么读出来不是我要的意思哦?
高手指教下~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
...全文
149 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
dashi 2006-11-21
  • 打赏
  • 举报
回复
str1 = "嘿嘿" str2 = "小心哈" str3 = "哦豁" Open App.Path & "\" & "wyp.txt" For Output As #1 write #1, str1 & str2 & str3 Close #1 dim str4,strTemp as string Open App.Path & "\" & "wyp.txt" For Input As #1 While Not EOF(1) Input #1, str4 strTemp =strTemp & str4 Wend Close #1
cangwu_lee 2006-11-21
  • 打赏
  • 举报
回复
也许,这样吧


Option Explicit

Private Sub Command1_Click()
Dim fp As String
fp = "c:\temp\" & "wyp.tmp"
Dim str1 As String, str2 As String, str3 As String

str1 = "嘿嘿"
str2 = "小心哈"
str3 = "哦豁"
Open fp For Output As #1
' Print #1, str1, str2, str3
Print #1, str1
Print #1, str2
Print #1, str3
Close #1

Open fp For Input As #1
Do While True
str1 = "": str2 = "": str3 = ""
' Input #1, str1, str2, str3
If EOF(1) Then Exit Do
Input #1, str1
If EOF(1) Then Exit Do
Input #1, str2
If EOF(1) Then Exit Do
Input #1, str3
Loop
Close #1
End Sub
LoveCJ 2006-11-20
  • 打赏
  • 举报
回复
帮顶.
chenhui530 2006-11-19
  • 打赏
  • 举报
回复
str1 = "嘿嘿"
str2 = "小心哈"
str3 = "哦豁"
Open App.Path & "\" & "wyp.txt" For Output As #1
write #1, str1 & str2 & str3
Close #1
dim str4,strTemp as string
Open App.Path & "\" & "wyp.txt" For Input As #1
While Not EOF(1)
Input #1, str4
strTemp =strTemp & str4
Wend
Close #1
wyp2120 2006-11-19
  • 打赏
  • 举报
回复
寒~~~~~~~~~`不对哈
假如txt文档的内容应该是
嘿嘿 小心哈 哦豁
HOHO 大使 地方
士大夫 感到 各单位
豆腐干地方 士大夫 敢死队法
我想用3个字符串变量读出(*********一行********)的内容
该如何读出,像C++那样
zsj1101 2006-11-18
  • 打赏
  • 举报
回复
str1 = "嘿嘿"
str2 = "小心哈"
str3 = "哦豁"
Open App.Path & "\" & "wyp.txt" For Output As #1
write #1, str1, str2, str3
Close #1

Open App.Path & "\" & "wyp.txt" For Input As #1
While Not EOF(1)
Input #1, str1, str2, str3
Wend
Close #1
为什么读出来不是我要的意思哦?
高手指教下~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
wyp2120 2006-11-18
  • 打赏
  • 举报
回复
首先声明,我不是一次读取一行
我是一次读取一个数据~~~~~~~~~`
哪个高手能帮我解决下啊~~~~~~~~~~~~~

742

社区成员

发帖
与我相关
我的任务
社区描述
VB 版八卦、闲侃,联络感情地盘,禁广告帖、作业帖
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧