<%
'*************************************** **********************
'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
%>
author: Xu renlu |
date: 2005-04-24 |