ASP TextStream Object
TextStream အရာဝတ္ထုကို စာသားဖိုင်တစ်ခု၏ အကြောင်းအရာများကို ဝင်ရောက်ကြည့်ရှုရန် အသုံးပြုသည်။
နောက်ထပ် ဥပမာများ
စာသားဖိုင်ကို စာသားဖိုင်တစ်ခုမှ
TextStream ဖိုင်၏ အစိတ်အပိုင်းတစ်ခုကိုသာ ဖတ်နည်း
TextStream ဖိုင်မှ စာကြောင်းတစ်ကြောင်းကို ဖတ်နည်း
ဖိုင်မှ စာကြောင်းအားလုံးကို ဖတ်နည်း။
ဖိုင်ကိုဖတ်သည့်အခါ သတ်မှတ်ထားသော စာလုံးအရေအတွက်ကို ကျော်နည်း။
TextStream ဖိုင်ကိုဖတ်သည့်အခါ စာကြောင်းတစ်ကြောင်းကို ကျော်သွားပုံ
ကို TextStream ဖိုင်တွင် လက်ရှိလိုင်းနံပါတ်ကို မည်သို့ပြန်ဆိုရမည်နည်း။
ဖိုင်တစ်ခုရှိ လက်ရှိဇာတ်ကောင်၏ ကော်လံနံပါတ်ကို ရယူနည်း။
TextStream အရာဝတ္ထု
TextStream အရာဝတ္ထုကို စာသားဖိုင်များ၏ အကြောင်းအရာများကို ဝင်ရောက်ကြည့်ရှုရန် အသုံးပြုသည်။
အောက်ပါကုဒ်သည် စာသားဖိုင် (c:\test.txt) ကို ဖန်တီးပြီး ဖိုင်သို့ စာသားအချို့ကို ရေးပေးသည် (variable f သည် TextStream အရာဝတ္ထု၏ ဥပမာတစ်ခုဖြစ်သည်)။
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("c:\test.txt",true)
f.WriteLine("Hello World!")
f.Close
set f=nothing
set fs=nothing
%>
TextStream အရာဝတ္ထု၏ စံနမူနာတစ်ခုကို ဖန်တီးရန် သင်သည် FileSystemObject အရာဝတ္ထု၏ CreateTextFile သို့မဟုတ် OpenTextFile နည်းလမ်းများကို အသုံးပြုနိုင်ပြီး၊ သို့မဟုတ် File object ၏ OpenAsTextStream နည်းလမ်းကို အသုံးပြုနိုင်သည်။
TextStream အရာဝတ္ထု၏ ဂုဏ်သတ္တိများနှင့် နည်းလမ်းများကို အောက်တွင် ဖော်ပြထားပါသည်။
သတ္တိ
Property | Description |
---|---|
AtEndOfLine | Returns true if the file pointer is positioned immediately before the end-of-line marker in a TextStream file, and false if not |
AtEndOfStream | Returns true if the file pointer is at the end of a TextStream file, and false if not |
Column | Returns the column number of the current character position in an input stream |
Line | Returns the current line number in a TextStream file |
နည်းလမ်းများ
Method | Description |
---|---|
Close | Closes an open TextStream file |
Read | Reads a specified number of characters from a TextStream file and returns the result |
ReadAll | Reads an entire TextStream file and returns the result |
ReadLine | Reads one line from a TextStream file and returns the result |
Skip | Skips a specified number of characters when reading a TextStream file |
SkipLine | Skips the next line when reading a TextStream file |
Write | Writes a specified text to a TextStream file |
WriteLine | Writes a specified text and a new-line character to a TextStream file |
WriteBlankLines | Writes a specified number of new-line character to a TextStream file |