ASP Metin Akışı Nesnesi
TextStream nesnesi, bir metin dosyasının içeriğine erişmek için kullanılır.
Daha fazla örnek
Bir metin dosyasından nasıl okunur.
dosyasının yalnızca bir bölümünü okuyun Bir TextStream dosyasının yalnızca bir bölümünü nasıl okunur.
dosyasının bir satırını okuyun Bir TextStream dosyasından bir satırı nasıl okunur.
dosyasındaki tüm satırları oku Bir TextStream dosyasındaki tüm satırlar nasıl okunur.
TextStream dosyasını okurken belirli sayıda karakter nasıl atlanır.
dosyasının satırını atla TextStream dosyasını okurken satır nasıl atlanır.
Satır numarasını döndür Bir TextStream dosyasında geçerli satır
Sütun numarası al Bir dosyadaki geçerli karakterin
TextStream Nesnesi
TextStream nesnesi, metin dosyalarının içeriğine erişmek için kullanılır.
Aşağıdaki kod, bir metin dosyası (c:\test.txt) oluşturur ve ardından dosyaya bir miktar metin yazar (f değişkeni, TextStream nesnesinin bir örneğidir):
<%
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 nesnesinin bir örneğini oluşturmak için FileSystemObject nesnesinin CreateTextFile veya OpenTextFile yöntemlerini veya File nesnesinin OpenAsTextStream yöntemini kullanabilirsiniz.
TextStream nesnesinin özellikleri ve yöntemleri aşağıda açıklanmıştır:
Özellikler
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 |
yöntemler
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 |