网络编程
位置:首页>> 网络编程>> Asp编程>> FSO如何一行行地读取文件?

FSO如何一行行地读取文件?

  发布时间:2010-06-10 18:40:00 

标签:fso,asp,读取,文件

如何一行行地读取文件?

这样就可以做到一行行地读出了:


dim input(30) 
' 定义一个数组,大小可随时更改.这里为了显示方便
file_path=Server.Mappath("index.html")
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set file_open=fs.OpenTextFile(file_path)
n=0
Do While Not file_open.AtEndOfStream
n=n+1
fileline=file_open.readline
input(i)=fileline 
' 将文件内容读入input数组
Loop 
file_open.close
Set fs=Nothing

另外,对于二进制数据,我们也可以用Read()来读取,如:

file_open.Read(200)

就是读取file_open中的200个数据。

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com