最新下载
热门教程
- 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
相关文章
- 星塔旅人等级怎么突破 等级突破方法 10-31
- 辉烬知世怎么配队 知世配队攻略 10-31
- 口袋斗罗大陆独孤博技能是什么 独孤博技能介绍一览 10-31
- 王者万象棋香香怎么玩 香香玩法介绍 10-31
- 王者万象棋阵容怎么搭配 阵容搭配攻略 10-31
- 王者万象棋怎么玩 新手玩法攻略 10-31
 
             
                                 
                                 
                                 
                                 
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                        