vbscript – AtEndOfLine

Property:  TextStream.AtEndOfLine


Implemented in version 2.0

object.AtEndOfLine

The AtEndOfLine property returns a Boolean value. If the file pointer is positioned immediately before the file’s end-of-line marker, the value is True. Otherwise, the value is False. The TextStream object must be open for reading or an error will occur when retreiving this property this method.

The following code uses the AtEndOfLine property to get the last character in the first line of text in a 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.AtEndOfLine <> true
contents = readfile.Read(1)
loop
readfile.close
Response.Write « The last character in the text file is ‘ » & contents & « ‘. »
%>

Output:
« The last character in the text file is ‘e’. »

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Vous pouvez utiliser ces balises et attributs HTML : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>