Features
Ask DevGuru
ASP Resources
Find the Bug
Knowledge Base
Links
Tips of the Week
Tutorials
Products
dgCalendar
dgCharge New!
dgChart New!
dgFileUpload
dgReport New!
dgSort
dgTree
Site
Authoring
Coming Soon
DevGuru Resume
Link to Us
Merchandise
Sponsorships
Testimonials
What's New
Technologies
ADO 2.6
ASP
CSS2
HTML
JavaScript
Jet SQL
Transact-SQL Syntax
VBScript
WML
WMLScript
WSH
XML DOM
All Properties
TextStream Object
Property: TextStream.Line
Implemented in version 2.0
object.
Line
The
Line
property is used to return the current line number in a text file. Upon opening a textfile and before any writing takes place,
Line
always returns '1'.
Code:
<%
dim filesys, text, readfile, contents, col, linumber
set filesys = CreateObject("Scripting.FileSystemObject")
Set text = filesys.CreateTextFile("c:\somefile2.txt")
text.Write "Find the last character in the text file"
text.close
set readfile = filesys.OpenTextFile("c:\somefile2.txt", 1, false)
do while readfile.AtEndOfStream <> true
contents = readfile.Read(1)
col = readfile.Column -1
linumber = readfile.Line
loop
readfile.close
Response.Write "The last character in line " & linumber & " is '" & contents & "' and_
its column number is '" & col & "'."
%>
Output:
"The last character in line 1 is 'e' and its column number is '40'."
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information