एएसपी टेक्स्टस्ट्रीम ऑब्जेक्ट
टेक्स्टस्ट्रीम ऑब्जेक्ट का उपयोग टेक्स्ट फ़ाइल की सामग्री तक पहुंचने के लिए किया जाता है।
और ज्यादा उदाहरण
टेक्स्ट फाइल से कैसे पढ़ें।
पढ़ें टेक्स्टस्ट्रीम फ़ाइल का केवल एक हिस्सा कैसे पढ़ें।
टेक्स्टस्ट्रीम फाइल से एक लाइन को कैसे पढ़ें।
टेक्स्टस्ट्रीम फ़ाइल से सभी पंक्तियों को कैसे पढ़ें।
को छोड़ें टेक्स्टस्ट्रीम फ़ाइल को पढ़ते समय निर्दिष्ट वर्णों की संख्या को कैसे छोड़ें।
छोड़ें टेक्स्टस्ट्रीम फ़ाइल को पढ़ते समय एक लाइन को कैसे छोड़ें।
टेक्स्टस्ट्रीम फ़ाइल में वर्तमान लाइन नंबर कैसे वापस करें।
कॉलम नंबर प्राप्त करें किसी फ़ाइल में वर्तमान वर्ण का
टेक्स्टस्ट्रीम ऑब्जेक्ट
टेक्स्टस्ट्रीम ऑब्जेक्ट का उपयोग टेक्स्ट फाइलों की सामग्री तक पहुंचने के लिए किया जाता है।
निम्न कोड एक टेक्स्ट फ़ाइल (c:\test.txt) बनाता है और फिर फ़ाइल में कुछ टेक्स्ट लिखता है (चर f टेक्स्टस्ट्रीम ऑब्जेक्ट का एक उदाहरण है):
<%
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
%>
टेक्स्टस्ट्रीम ऑब्जेक्ट का उदाहरण बनाने के लिए आप FileSystemObject ऑब्जेक्ट के CreateTextFile या OpenTextFile विधियों का उपयोग कर सकते हैं, या आप फ़ाइल ऑब्जेक्ट की 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 |