adodb.stream讀文件到數(shù)組的代碼
更新時間:2008年08月01日 23:34:53 作者:
用adodb.stream讀取文件并保存為數(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)文章
利用WSH里的MapNetworkDrive方法腳本蠕蟲的傳播方式
利用WSH里的MapNetworkDrive方法腳本蠕蟲的傳播方式...2007-02-02
VBS基礎(chǔ)篇 - 條件語句(if與Select Case)
經(jīng)常地,當我們編寫代碼時,我們需要根據(jù)不同的判斷執(zhí)行不同操作,我們可以使用條件語句完成這個工作,asp中的條件語句主要是if與Select Case這里就為大家介紹一下,需要的朋友可以參考下2018-05-05

