adodb.stream讀文件到數(shù)組的代碼
更新時(shí)間:2008年08月01日 23:34:53 作者:
用adodb.stream讀取文件并保存為數(shù)組的實(shí)現(xiàn)代碼
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)
相關(guān)文章
用vbscript實(shí)現(xiàn)在文本文件中搜索兩個(gè)項(xiàng)
用vbscript實(shí)現(xiàn)在文本文件中搜索兩個(gè)項(xiàng)...2007-04-04vbs 搜索代理地址實(shí)現(xiàn)代碼[小偷程序]
將下面的代碼,直接保存為getproxy.vbs即可。2009-10-10用vbs實(shí)現(xiàn)配置無人登錄計(jì)算機(jī)時(shí)使用的屏幕保護(hù)程序
用vbs實(shí)現(xiàn)配置無人登錄計(jì)算機(jī)時(shí)使用的屏幕保護(hù)程序...2007-03-03VBS教程:函數(shù)-TimeSerial 函數(shù)
VBS教程:函數(shù)-TimeSerial 函數(shù)...2006-11-11