手机
当前位置:查字典教程网 >编程开发 >ASP教程 >利用AdoDb.Stream对象来读取UTF-8格式的文本文件
利用AdoDb.Stream对象来读取UTF-8格式的文本文件
摘要:复制代码代码如下:'函数名称:ReadTextFile'作用:利用AdoDb.Stream对象来读取UTF-8格式的文本文件'-------...

复制代码 代码如下:

'函数名称:ReadTextFile

'作用:利用AdoDb.Stream对象来读取UTF-8格式的文本文件

'----------------------------------------------------

FunctionReadFromTextFile(FileUrl,CharSet)

IfFileUrl=""ORIsNull(FileUrl)Then

ReadFromTextFile=""

ExitFunction

EndIf

IfNotFLib.IsReallyPath(FileUrl)Then

FileUrl=Server.MapPath(FileUrl)

EndIf

dimstr,stm

setstm=server.CreateObject("adodb.stream")

stm.Type=2'以本模式读取

stm.mode=3

stm.charset=CharSet

stm.open

stm.loadfromfileFileUrl

str=stm.readtext

stm.Close

setstm=nothing

ReadFromTextFile=str

EndFunction

'-------------------------------------------------

'函数名称:WriteToTextFile

'作用:利用AdoDb.Stream对象来写入UTF-8格式的文本文件

'----------------------------------------------------

FunctionWriteToTextFile(FileUrl,byvalStr,CharSet)

IfFileUrl=""ORIsNull(FileUrl)Then

WriteToTextFile=""

ExitFunction

EndIf

IfNotFLib.IsReallyPath(FileUrl)Then

FileUrl=Server.MapPath(FileUrl)

EndIf

Dimstm

setstm=server.CreateObject("adodb.stream")

stm.Type=2'以本模式读取

stm.mode=3

stm.charset=CharSet

stm.open

stm.WriteTextstr

stm.SaveToFileFileUrl,2

stm.flush

stm.Close

setstm=nothing

EndFunction

【利用AdoDb.Stream对象来读取UTF-8格式的文本文件】相关文章:

利用Adodb.Stream制作彩色验证码

用ASP打开远端MDB文件的方法

读取目录下的所有文件(包括子目录下的所有文件)

ASP Request对象的使用

FileSystem对象常用的文件操作函数有哪些?

利用FSO取得BMP,JPG,PNG,GIF文件信息

学习使用ASP对象和组件

ASP中Response对象的集合、属性和方法介绍

ASP使用FSO读取模板的代码

ASP中生成文本文件的两种方式

精品推荐
分类导航