VB 文件写入的操作
abc.txt文件里有一行数据34/45/56打开文件,把5个数据赋予变量a,b,c,第一个数据加5,第二个数据加6,第三个数据加7,保存。代码尽量简单易懂。是3个数据3...
abc.txt文件里有一行数据
34/45/56
打开文件,把5个数据赋予变量a,b,c,第一个数据加5,第二个数据加6,第三个数据加7,保存。代码尽量简单易懂。
是3个数据34/45/56 展开
34/45/56
打开文件,把5个数据赋予变量a,b,c,第一个数据加5,第二个数据加6,第三个数据加7,保存。代码尽量简单易懂。
是3个数据34/45/56 展开
展开全部
Private Sub Form_Load()
Dim a, s As String
Open "d:\abc.txt" For Input As 1
Line Input #1, s
a = Split(s, "/")
a(0) = Val(a(0) + 5)
a(1) = Val(a(1) + 6)
a(2) = Val(a(2) + 7)
Close
Open "d:\abc.txt" For Output As 1
Write #1, a(0); a(1); a(2)
Close
End
End Sub
Dim a, s As String
Open "d:\abc.txt" For Input As 1
Line Input #1, s
a = Split(s, "/")
a(0) = Val(a(0) + 5)
a(1) = Val(a(1) + 6)
a(2) = Val(a(2) + 7)
Close
Open "d:\abc.txt" For Output As 1
Write #1, a(0); a(1); a(2)
Close
End
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim Words() As String, a As Long, b As Long, c As Long, Temp As String
Open "C:\abc.txt" For Input As #1
Line Input #1, Temp
Close #1
Nums = Split(Temp, "/")
a = Val(Nums(0)) + 5
b = Val(Nums(1)) + 6
c = Val(Nums(2)) + 7
Temp = a & "/" & b & "/" & c
Open "C:\abc.txt" For Output As #1
Print #1, Temp
Close #1
Open "C:\abc.txt" For Input As #1
Line Input #1, Temp
Close #1
Nums = Split(Temp, "/")
a = Val(Nums(0)) + 5
b = Val(Nums(1)) + 6
c = Val(Nums(2)) + 7
Temp = a & "/" & b & "/" & c
Open "C:\abc.txt" For Output As #1
Print #1, Temp
Close #1
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
哪5个数据?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询