当前位置:主页 > 查看内容

如何一行行地读取文件?

发布时间:2021-04-18 00:00| 位朋友查看

简介: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.AtEndOfS……

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个数据。


本文转载自网络,原文链接:https://m.jb51.net/article/4711.htm
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐