The ASP ReadLine Method is used to read one line from a Text file. It does not include newline characters. It is a predefined method of the TextStream Object that returns a result string.
Syntax:
TextStreamObject.ReadLine
Example: Below code illustrates the ASP ReadLine Method.
ASP
<% dim fs,f,t,x set fs=Server.CreateObject( "Scripting.FileSystemObject" )
set f=fs.CreateTextFile( "d:\GFG.txt" )
f.writeline( "GeeksForGeeks" )
f.writeline( "Google Chrome" )
f.writeline( "Mozilla Firefox" )
f.close set t=fs.OpenTextFile( "d:\GFG.txt" ,1,false)
x=t.ReadLine t.close Response.Write( "The first line in the file " & x)
%> |
Output:
The first line in the file is GeeksForGeeks