Copy codeThe Code is as follows: <%
'*************************************** **********************
'Keep this declaration information during forwarding. This declaration does not affect your speed!
'*************************************** **********************
'*************************************** **********************
'@ Author: Noodle
'@ Realname: Xu renlu
'@ Email: xurenlu@sohu.com
'@ QQ: 55547082'
'@ Homepage: http://www.ksdn.net
'@ Copyright:
'Non-profit groups or individuals can use them for free.
'*************************************** **********************
'*************************************** **********************
'Class name: files
'Class function: implements file read/write, and uses adodb. stream to read and write files on hosts that do not support fso.
'*************************************** **********************
Class files
Private adSaveCreateOverWrite 'existing files can be overwritten during file creation.
Private adSaveCreateNotExist: if the file does not exist when saving the file, you can create a file.
'*************************************** **********************
'Event name: Class_Initialize ()
'Event Occurrence Condition: this event is generated when the class is created.
'Event content: assign values to private variables
'Event input parameters: None
'*************************************** **********************
Sub Class_Initialize ()
AdSaveCreateOverWrite = 2
AdSaveCreateNotExist = 1
End sub
'*************************************** **********************
'Function name: function readfile (filepath)
'Function content: Read the file
'Input parameter: filepath: absolute path of the file to be read
'Return parameter: content of the file to be read.
'*************************************** **********************
Function readfile (filepath)
On error resume next
Dim stm2
Set stm2 = server. createobject ("ADODB. Stream ")
Listen 2.charset = "gb2312"
Ipv2.open
Secrets 2.loadfromfile filepath
Readfile = pai2.readtext
End function
'*************************************** **********************
'Function name: function writefile (filepath, str)
'Function content: Write File
'Input parameter: filepath: absolute path of the file to be read
'Str: content to be written
'Return parameter: None
'*************************************** **********************
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 name: function copy (filepath_s, filepath_d)
'Function content: Read the file
'Input parameter: filepath_d: absolute path of the target file
'Filepath_s: source file path
'*************************************** **********************
Function copy (filepath_s, filepath_d)
On error resume next
Dim stm2
Set stm2 = server. createobject ("ADODB. Stream ")
Listen 2.charset = "gb2312"
Ipv2.open
Stm2.LoadFromFile filepath_s
2.savetofile filepath_d, adSaveCreateOverWrite
End function
End class
%>