好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

如何一行行地读取文件?_编程10000问_

NEWSZW_HZH_BEGIN-->

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

NEWSZW_HZH_END-->

查看更多关于如何一行行地读取文件?_编程10000问_的详细内容...

  阅读:51次