ایس پی تیکس اسٹریم اوبجیکٹ

The TextStream object is used to access the content of the text file.

مثال

فائل پڑھنا
این مثال دکھاتا ہے کہ چطور فائل سسٹم آپج کی مدد سے فائل کا پتا لینا اور اس پر فائل سٹریم آپج کو کھولنا. فائل سٹریم آپج کا ریکھلا لینا کا طریقہ.
نوکری فائل کا ایک حصہ پڑھنا
این مثال دکھاتا ہے کہ چطور فائل سٹریم فائل کا ایک حصہ صرف پڑھا جاسکتا ہے.
نوکری فائل کا ایک سطر پڑھنا
این مثال دکھاتا ہے کہ چطور فائل سٹریم فائل سے ایک سطر کا پتا لینا.
نوکری فائل کا تمام سطر پڑھنا
این مثال دکھاتا ہے کہ چطور فائل سٹریم فائل سے تمام سطر پڑھا جاسکتا ہے.
نوکری فائل کا ایک حصہ چھوڑنا
این مثال دکھاتا ہے کہ چطور فائل سٹریم فائل میں مخصوص حروف کی تعداد کو چھوڑ سکتا ہے.
略过文本文件的一行
This example demonstrates how to skip a line when reading a text stream file.
Return line number
This example demonstrates how to return the current line number in the text stream file.
Get column number
This example demonstrates how to get the column number of the current character in the file.

TextStream object

The TextStream object is used to access the content of the text file.

The following code will create a text file (c:\test.txt) and then write some text to this file (variable f is an instance of a TextStream object):

<% 
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
%>

To create an instance of a TextStream object, we can use the CreateTextFile method or OpenTextFile method of the FileSystemObject object, or use the OpenAsTextStream method of the File object.

The properties and methods of the TextStream object are described as follows:

Property

Property Description
AtEndOfLine In the TextStream file, if the file pointer is exactly in front of the line end marker, the property value returns True; otherwise, it returns False.
AtEndOfStream If the file pointer is at the end of the TextStream file, the property value returns True; otherwise, it returns False.
Column Return the column number of the current character position in the TextStream file.
Line Return the current line number in the TextStream file.

Method

Method Description
Close ਇੱਕ ਖੁੱਲ੍ਹੀ TextStream ਫਾਈਲ ਨੂੰ ਬੰਦ ਕਰੋ。
Read ਇੱਕ TextStream ਫਾਈਲ ਤੋਂ ਨਿਰਧਾਰਿਤ ਸਿਫ਼ਾਰਸ਼ ਅੰਕਬਾਨ ਨੂੰ ਪੜੋ ਅਤੇ ਨਤੀਜਾ ਵਾਪਸ ਦੇਵੋ (ਮਿਲਿਆ ਪਰਿਭਾਸ਼ਿਤ ਸਟ੍ਰਿੰਗ ਵਾਪਸ ਦੇਵੋ)
ReadAll ਪੂਰੀ TextStream ਫਾਈਲ ਨੂੰ ਪੜੋ ਅਤੇ ਨਤੀਜਾ ਵਾਪਸ ਦੇਵੋ。
ReadLine ਇੱਕ ਪੂਰੀ ਲਾਈਨ ਨੂੰ TextStream ਫਾਈਲ ਤੋਂ ਪੜੋ (ਬਦਲੇ ਹੋਏ ਲਾਈਨ ਮਾਰਕਰ ਤੱਕ ਜਾਂ ਬਿਨਾ ਉਸ ਤੋਂ ਬਿਨਾ) ਅਤੇ ਨਤੀਜਾ ਵਾਪਸ ਦੇਵੋ。
Skip ਇੱਕ TextStream ਫਾਈਲ ਦੇ ਸਮੇਂ ਨਿਰਧਾਰਿਤ ਸਿਫ਼ਾਰਸ਼ ਅੰਕਬਾਨ ਨੂੰ ਛੱਡੋ。
SkipLine ਇੱਕ TextStream ਫਾਈਲ ਦੇ ਸਮੇਂ ਅਗਲੀ ਲਾਈਨ ਨੂੰ ਛੱਡੋ。
Write مخصوص متن (نکات) لکھنا، ایک فائل میں TextStream میں
WriteLine مخصوص متن (نکات) اور نیو لائن لکھنا، ایک فائل میں TextStream میں
WriteBlankLines مخصوص تعداد کی نیو لائنز لکھنا، ایک فائل میں TextStream میں