现在位置: 首页 > ASP 教程 > 正文

ASP ReadAll 方法


TextStream 对象参考手册 完整的 TextStream 对象参考手册

ReadAll 方法可读取整个 TextStream 文件,并以字符串返回结果。

注意:此方法不适合大型文件(会浪费内存资源)。

语法

TextStreamObject.ReadAll

实例

<%
dim fs,f,t,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("c:\test.txt"")
f.write("Hello World!")
f.close

set t=fs.OpenTextFile("c:\test.txt"",1,false)
x=t.ReadAll
t.close
Response.Write("The text in the file is: " & x)
%>

输出:

The text in the file is: Hello World!


TextStream 对象参考手册 完整的 TextStream 对象参考手册