..


Sponsored Links

ReadAll

The method of ReadAll 'TextStream reads the entire contents of a file opened through textstream object and returns the result as a string.

Note: This method is not suitable for large files (as large memory resources are wasted).

Let's take an example.
Suppose you have a text file (c: \ test.txt) with the following contents:

 



 Hello what's your name?

 
Now we see the code:





 dim fs, t, x









 'I create an instance of the FSO







 Set fs = Server.CreateObject ("Scripting.FileSystemObject")

 







 'I open the file in read mode







 set T = fs.OpenTextFile ("c: \ test.txt", 1, false)









 'I read all the contents of the file







 x = t.ReadAll









 'Close







 t.close

 







 'I cleaned







 set T = Nothing







 Set fs = Nothing









 'Print to video







 Output:

 
 



 The text file is: Hello what's your name?

 

In the same category ...
E-Learning
ASP (Advanced) ASP (Advanced)
Full course for creating dynamic Web sites. From 39 €.
ASP Zero (Ebook) ASP Zero (Ebook)
Learning Microsoft ASP and VBScript from scratch. At only 29 €.
ASP and Access (Ebook) ASP and Access (Ebook)
Managing a MS Access database with ASP. At only 29 €.
Sponsored Links