Skip to content
Related Articles

Related Articles

Improve Article
ASP Read Method
  • Last Updated : 03 Mar, 2021

The ASP Read Method is used for reading a specified number of characters in a TextStream file. It is a predefined method of the TextStream Object that returns a result as a string. 

Syntax:

TextStreamObject.Read(numchar)

Parameter Value:

  • numchar: Required attribute. It contains a numeric value that represents the number of characters that you want to read from the file.

Example: Below code illustrates the ASP Read Method. 

ASP




<%
dim gfg,f,t,x
set gfg=Server.CreateObject("Scripting.FileSystemObject")
set f=gfg.CreateTextFile("e:\GFG.txt")
f.write("Hello GeeksForGeeks")
f.close
  
set t=gfg.OpenTextFile("e:\GFG.txt",1,false)
x=t.Read(10)
t.close
Response.Write("The First Ten characters are: " & x)
%>

Output:

Hello Geeks
My Personal Notes arrow_drop_up
Recommended Articles
Page :