ReadAll

收藏:0   阅读:23

ASP ReadAll 方法


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!
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!