免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
FileSystemObject的TextStream物件
FileSystemObject的TextStream物件 - 小瓜瓜 [首頁]
●先由FileSystemObject來建立TextStream物件:
Private Sub Command1_Click()
Set FSysObj = CreateObject("Scripting.FileSystemObject")
Set TStrmObj = FSysObj.OpenTextFile("C:\Test.txt", 8, True)
End Sub
●HTML、HTA下寫法一樣
<script language=vbscript>
Set FSysObj = CreateObject("Scripting.FileSystemObject")
Set TStrmObj = FSysObj.OpenTextFile("C:\Test.txt", 8, True)
</script>
●ASP下寫法也一樣
<%
Set FSysObj = Server.CreateObject("Scripting.FileSystemObject")
Set TStrmObj = FSysObj.OpenTextFile("C:\Test.txt", 8, True)
%>

●建立好TextStream後,就可以對(duì)檔案做讀與寫的動(dòng)作。
●說明:8指的是附加模式,2為覆蓋模式,1為讀檔模式,True指的是檔案若不存在則建立該檔案。

●TextStream.Write與TestStream.WriteLine:這兩個(gè)都是把資料寫到開起的檔案,只不過WriteLine寫完資料後會(huì)自動(dòng)補(bǔ)上vbCrLf。

Private Sub Command1_Click()
Set FSysObj = CreateObject("Scripting.FileSystemObject")
Set TStrmObj = FSysObj.OpenTextFile("C:\Test.txt", 2, True)
TStrmObj.Write "hi,"
TStrmObj.WriteLine "hello"
End Sub
●TextStream.Read、TestStream.ReadLine與TextStream:這三個(gè)都是把資料從檔案裡讀出來,Read是讀取某幾個(gè)字,ReadLine是讀取一行而ReadAll則是讀入整個(gè)檔案。
Private Sub Command1_Click()
Set FSysObj = CreateObject("Scripting.FileSystemObject")
Set TStrmObj = FSysObj.OpenTextFile("C:\Test.txt", 1, True)
MsgBox TStrmObj.Read(2) '讀兩個(gè)字
End Sub
●TextStream.Read、TestStream.ReadLine與TextStream:這三個(gè)都是把資料從檔案裡讀出來,Read是讀取某幾個(gè)字,ReadLine是讀取一行而ReadAll則是讀入整個(gè)檔案。
<script language="vbscript">
Set FSysObj = CreateObject("Scripting.FileSystemObject")
Set TStrmObj = FSysObj.OpenTextFile("C:\Test.txt", 1, True)
Document.Write Replace(TStrmObj.ReadAll,vbCrLf,"<br />") '整個(gè)檔案讀出來
</script>

●TextStream.AtEndOfStream可傳回是否已經(jīng)讀到檔尾:

Private Sub Command1_Click()
Set FSysObj = CreateObject("Scripting.FileSystemObject")
Set TStrmObj = FSysObj.OpenTextFile("C:\Test.txt", 1, True)
Do Until TStrmObj.AtEndOfStream = True
MsgBox TStrmObj.Read(1)
Loop
End Sub

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
ASP FSO文件操作
ASP 如何讀寫一個(gè)文本文件
VBA中的FileSystemObject對(duì)象(FSO)和文本流
VBScript:處理文件(創(chuàng)建、寫入、讀取、刪除)
VBS FSO操作全集
「懶惰工作」報(bào)復(fù)盜取你的EXCEL文檔的人(VBA)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服