Open In App

ASP ReadAll Method

Improve
Improve
Like Article
Like
Save
Share
Report

The ASP ReadAll Method is used to read all the contents from the Text file. It is a predefined method of the TextStream Object that returns a result string. 

Note: This method is not suitable for large files because it wastes memory resources. 

Syntax:

TextStreamObject.ReadAll 

Example Code: Below code illustrates the ASP ReadAll Method. 

ASP




<%
dim fs,f,t,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("d:\GFG.txt")
f.write("Hello GeeksForGeeks. A computer science portal for geeks")
f.close
  
set t=fs.OpenTextFile("d:\GFG.txt",1,false)
x=t.ReadAll
t.close
Response.Write("The entire content in the file is: " & x)
%>


Output:

The entire content in the files is : Hello GeeksForGeeks A computer science portal for geeks. 

Last Updated : 03 Mar, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads