ASP ReadAll Method
❮ อ้างอิงวัตถุ 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)
%>
Output:
The text in the file is: Hello World!
❮ อ้างอิงวัตถุ TextStream ที่สมบูรณ์