欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp之基于adodb.stream的文件操作類

 更新時間:2007年08月30日 10:22:30   作者:  
復(fù)制代碼 代碼如下:

<%

'*************************************************************
'轉(zhuǎn)發(fā)時請保留此聲明信息,這段聲明不并會影響你的速度!
'*************************************************************


'*************************************************************
'@author:                        面條
'@realname:                        徐仁祿
'@email:                        xurenlu@sohu.com
'@QQ:                            55547082
'@Homepage:                        http://www.ksdn.net
'@版權(quán)申明:
'            非盈利性質(zhì)團體或者個人可以免費使用.
'*************************************************************


'*************************************************************
'        類名稱:        files
'        類功能:            實現(xiàn)文件讀寫功能,利用adodb.stream實現(xiàn),在不支持fso的主機上也可以讀寫文件.
'*************************************************************

class files


    private adSaveCreateOverWrite    '創(chuàng)建文件的時候可以覆蓋已經(jīng)存在的文件.
    private adSaveCreateNotExist    '保存文件的時候如果文件不存在,可以創(chuàng)建文件.


'*************************************************************
'        事件名稱:        Class_Initialize()
'        事件發(fā)生條件:    類創(chuàng)建時候產(chǎn)生該事件
'        事件內(nèi)容:        給私有變量賦值
'        事件傳入?yún)?shù):    無
'*************************************************************


    sub Class_Initialize()
        adSaveCreateOverWrite =2
        adSaveCreateNotExist = 1
    end sub


'*************************************************************
'        函數(shù)名稱:        function readfile(filepath)
'        函數(shù)內(nèi)容:        讀出文件
'        傳入?yún)?shù):        filepath:要讀的文件的絕對路徑
'        返回參數(shù):        要讀的文件的內(nèi)容.
'*************************************************************
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


'*************************************************************
'        函數(shù)名稱:        function writefile(filepath,str)
'        函數(shù)內(nèi)容:        寫入文件
'        傳入?yún)?shù):        filepath:要讀的文件的絕對路徑
'                        str:    要寫入的內(nèi)容
'        返回參數(shù):        無返回
'************************************************************* 
    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



'*************************************************************
'        函數(shù)名稱:        function copy(filepath_s,filepath_d)
'        函數(shù)內(nèi)容:        讀出文件
'        傳入?yún)?shù):        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
%>

相關(guān)文章

最新評論