adodb.stream读文件到数组的代码
程序员文章站
2022-04-10 18:56:59
function filenum(filename,i) dim st,s set st= createobject("...
function filenum(filename,i)
dim st,s
set st= createobject("adodb.stream")
st.type = 2 '流类型为文本
st.mode = 3 '模式为读写
st.open
st.lineseparator=13
st.loadfromfile filename
do while not st.eos
s = split(st.readtext(), vbcrlf)
loop
'msgbox ubound(s) total
filenum=s(i)
st.close
end function
msgbox filenum("file.txt",2)
dim st,s
set st= createobject("adodb.stream")
st.type = 2 '流类型为文本
st.mode = 3 '模式为读写
st.open
st.lineseparator=13
st.loadfromfile filename
do while not st.eos
s = split(st.readtext(), vbcrlf)
loop
'msgbox ubound(s) total
filenum=s(i)
st.close
end function
msgbox filenum("file.txt",2)