Partager via


AtEndOfLine Property (FileSystemObject)

 

Returns true if the file pointer is positioned immediately before the end-of-line marker in a TextStream file; false if it is not. Read-only.

Syntax

object.AtEndOfLine

Remarks

The object is always the name of a TextStream object.

The AtEndOfLine property applies only to TextStream files that are open for reading; otherwise, an error occurs.

The following code illustrates the use of the AtEndOfLine property:

function GetALine(filespec) {
    var ForReading = 1;

    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var file = fso.OpenTextFile(filespec, ForReading, false);

    var s = "";
    while (!file.AtEndOfLine) {
        s += file.Read(1);
    }
    file.Close();
    return (s);
}
Function GetALine(filespec)
    Dim fso, file, s
    Const ForReading = 1

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set file = fso.OpenTextFile(filespec, ForReading, False)

    s = ""
    Do While file.AtEndOfLine <> True
        s = s & file.Read(1)
    Loop
    file.Close
    GetALine = s
End Function

Applies To:

TextStream Object

Change History

Date

History

Reason

September 2010

Modified examples.

Customer feedback.

See Also

AtEndOfStream Property (FileSystemObject)