当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何显示一个文本文件?

如何显示一个文本文件?

2017年12月08日  | 移动技术网IT编程  | 我要评论

 writestring

    writelinestring

    writeblanklineslines

 

    html

    head

    http-equiv="content-type" content="text/html;

    charset=gb2312"

    title〉春风精彩之文本文件显示〈/title

    /head

 

   〈body

    <% language = vbscript %>

    <%

const forreading = 1, forwriting = 2, forappending = 3

' 参数为可选,决定输入/输出模式:①forreading=1只读;②forwriting=2 可读写;③forappending=3追加.

const tristateusedefault = -2, tristatetrue = -1, tristatefalse = 0

  ' 参数为可选,指出以何种格式打开文件:①忽略此参数,以 ascii格式打开文件;②tristateusedefault=-2 以系统默认格式打开文件;③tristatetrue=-1 unicode 格式打开文件;④tristatefalse=0 ascii 格式打开文件,当然我们也可用opentextfile方法打开文件.

      

    dim filename

    filename = "test.txt"

      ' 缺省路径c:\win.

 

    set fs = createobject("scripting.filesystemobject")

    set f = fs.getfile(filename)

    set readf = f.openastextstream(forreading,tristatefalse)

 

    s = readf.readline

    do while readf.atendofline <> true

        s = readf.readline

        response.write s & ""

            ' 逐行读文件并写屏.

    loop

    readf.close

    %>

    </body></html>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网