如何在VB中读入文本文件,然后逐行进行计算。请高手解答啊!
来源:百度知道 编辑:UC知道 时间:2024/06/22 20:46:31
如:1
2
3
4
5
然后,运行后变成2
4
6
8
10
2
3
4
5
然后,运行后变成2
4
6
8
10
dim a() as long,No as long,s as string,i as long
no=0
open "d:\filename.txt" for input as #1
do while not eof(1)
line input #1 ,s
no=no+1
redim preserve a(no)
a(no-1)=val(s)
loop
close #1
open "d:\filename.txt" for output as #1
for i=0 to no-1
write #1,a(i) *2
next
close #1