最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp读取写文件fso实例代码
时间:2022-06-30 11:41:36 编辑:袖梨 来源:一聚教程网
'==============================
'函 数 名:FsoLineWrite
'作 用:按行写入文件
'参 数:文件相对路径FilePath,写入行号LineNum,写入内容LineContent
'==============================
Function FsoLineWrite(FilePath,LineNum,LineContent)
If LineNum<1 Then Exit Function
Set Fso=Server.CreateObject("Scri"&"pting.File"&"Sys"&"temObject")
If Not Fso.FileExists(Server.MapPath(FilePath)) Then Exit Function
Temp=FsoFileRead(FilePath)
TempArr=Split(Temp,Chr(13)&Chr(10))
TempArr(LineNum-1)=LineContent
Temp=Join(TempArr,Chr(13)&Chr(10))
Call CreateFile(FilePath,Temp)
Set Fso=Nothing
End Function
'==============================
'函 数 名:FsoFileRead
'作 用:读取文件
'参 数:文件相对路径FilePath
'==============================
Function FsoFileRead(FilePath)
Set objAdoStream = Server.CreateObject("A"&"dod"&"b.St"&"r"&"eam")
If Err.Number=-2147221005 Then
Response.Write "方卡错误提示:服务器不支持ADODB.Stream"
Err.Clear
Response.End
End If
With objAdoStream
.type=2
.mode=3
.Charset = "utf-8"
.Open
.LoadFromFile Server.MapPath(FilePath)
.Position = 2
FsoFileRead=.ReadText
End With
objAdoStream.Close
Set objAdoStream=Nothing
End Function
相关文章
- Docker部署Ollama搭建本地AI开发环境实用指南 10-09
- Git SSH配置教程:如何生成公钥并添加GitLab实用指南 10-09
- gitee码云删除仓库实现方式教程实用指南 10-09
- 学习通网页版登录入口-学习通官网网址一键登录 10-08
- POKI小游戏免费秒玩入口-POKI小游戏在线秒玩网页版即点即玩 10-08
- jmcomic3.0网页版入口-JMComic最新网页版入口 10-08