Property:  TextStream.Column

Implemented in version 2.0
 
object.Column

The Column property returns the current position of the file pointer within the current line. Column 1 is the first character in each line.

The follwing code uses the Column property to get the column number of the last character in a text file.

Code:
<%
dim filesys, text, readfile, contents
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
loop
readfile.close
Response.Write "The last character in the text file is '" & contents & "' and its_
                                column number is '" & col & "'."
%>

Output:
"The last character in the text file is 'e' and its column number is '40'."


Copyright 1999-2004 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information