欢迎来到代码驿站!

当前位置:首页 >

如何显示一个文本文件?

时间:2021-11-24 13:58:55|栏目:|点击:

 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>

上一篇:Docker可视化管理工具DockerUI的使用

栏    目:

下一篇:docker 容器上编译 go 程序提示找不到文件问题

本文标题:如何显示一个文本文件?

本文地址:http://www.codeinn.net/misctech/184667.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有