asp如何用FSO对象显示一个文本文件?
来源:asp之家 时间:2010-06-09 18:41:00
如何显示一个文本文件?
完整显示文本文件的代码如下:
Write(STRING)
WriteLine(STRING)
WriteBlankLines(LINES)
〈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>


猜你喜欢
vue实现触底查询功能

SQL常用数据库操作命令使用方法
在windows下使用python进行串口通讯的方法
Python进程间通讯与进程池超详细讲解
JS实现用户管理系统

django列表筛选功能的实现代码
如何让利用Python+AI使静态图片动起来

详解MySQL 重做日志(redo log)与回滚日志(undo logo)
Python在字典中获取带权重的随机值实现方式
Access报错:文件共享锁定数溢出
goland设置控制台折叠效果

Python PyQt5模块实现一个浏览器的示例代码

python爬虫利用代理池更换IP的方法步骤

python 包之 multiprocessing 多进程
PLSQLDeveloper登录远程连接Oracle的操作

Git工作流演示及三种工作方式

谈中国站长站的文章干扰码实现方法

Python闭包之返回函数的函数用法示例

Python如何使用ElementTree解析xml
