asp 기반 adodb.stream 파일 작업 클래스
3692 단어 asp 기반 adodb.stream 파일 작업 클래스
<%
'*************************************************************
' , !
'*************************************************************
'*************************************************************
'@author:
'@realname:
'@email: [email protected]
'@QQ: 55547082
'@Homepage: http://www.ksdn.net
'@ :
' .
'*************************************************************
'*************************************************************
' : files
' : , adodb.stream , fso .
'*************************************************************
class files
private adSaveCreateOverWrite ' .
private adSaveCreateNotExist ' , .
'*************************************************************
' : Class_Initialize()
' :
' :
' :
'*************************************************************
sub Class_Initialize()
adSaveCreateOverWrite =2
adSaveCreateNotExist = 1
end sub
'*************************************************************
' : function readfile(filepath)
' :
' : filepath:
' : .
'*************************************************************
function readfile(filepath)
on error resume next
dim stm2
set stm2 =server.createobject("ADODB.Stream")
stm2.Charset = "gb2312"
stm2.Open
stm2.LoadFromFile filepath
readfile = stm2.ReadText
end function
'*************************************************************
' : function writefile(filepath,str)
' :
' : filepath:
' str:
' :
'*************************************************************
function writefile(filepath,str)
on error resume next
Set stm = server.createobject("ADODB.Stream")
stm.Charset = "gb2312"
stm.Open
stm.WriteText str
stm.SaveToFile filepath, adSaveCreateOverWrite
end function
'*************************************************************
' : function copy(filepath_s,filepath_d)
' :
' : filepath_d:
' filepath_s:
'*************************************************************
function copy(filepath_s,filepath_d)
on error resume next
dim stm2
set stm2 =server.createobject("ADODB.Stream")
stm2.Charset = "gb2312"
stm2.Open
stm2.LoadFromFile filepath_s
stm2.SaveToFile filepath_d, adSaveCreateOverWrite
end function
end class
%>