************************************************* *
'関数名: FSOFileRead
'機能: FSO を使用してファイルの内容を読み取る関数
'パラメータ: ファイル名 ---- ファイル名
'戻り値: ファイルの内容
'************************************************ *
関数 FSOFileRead(ファイル名)
Dim objFSO、objCountFile、FiletempData
objFSO = Server.CreateObject(Scripting.FileSystemObject) を設定します。
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(ファイル名),1,True)
FSOFileRead = objCountFile.ReadAll
objCountFile.Close
objCountFile=Nothing を設定します
objFSO = なしを設定します
終了機能
'************************************************ *
'関数名:FSOlinedit
'機能: FSO を使用してファイル関数の特定の行を読み取ります
'パラメータ: ファイル名 ---- ファイル名
' lineNum ---- 行番号
'戻り値: ファイル内の行の内容
'************************************************ *
関数 FSOlinedit(ファイル名,行番号)
linenum < 1 の場合、関数を終了します
dim fso、f、temparray、tempcnt
set fso = server.CreateObject(scripting.filesystemobject)
fso.fileExists(server.mappath(filename)) でない場合は関数を終了します
set f = fso.opentextfile(server.mappath(ファイル名),1)
f.AtEndofStream ではない場合
tempcnt = f.readall
f.閉じる
f = 何も設定しない
temparray = split(tempcnt,chr(13)&chr(10))
if lineNum>ubound(temparray)+1 then
終了関数
それ以外
FSOlinedit = temparray(lineNum-1)
終了する場合
終了する場合
終了関数
'************************************************ *
'関数名: FSOlinewrite
'機能: FSO を使用してファイル関数の特定の行を書き込みます
'パラメータ: ファイル名 ---- ファイル名
' lineNum ---- 行番号
' 行内容 ---- 内容
'戻り値: なし
'************************************************ *
関数 FSOlinewrite(ファイル名,行番号,行内容)
linenum < 1 の場合、関数を終了します
dim fso、f、temparray、tempCnt
set fso = server.CreateObject(scripting.filesystemobject)
fso.fileExists(server.mappath(filename)) でない場合は関数を終了します
set f = fso.opentextfile(server.mappath(ファイル名),1)
f.AtEndofStream ではない場合
tempcnt = f.readall
f.閉じる
temparray = split(tempcnt,chr(13)&chr(10))
if lineNum>ubound(temparray)+1 then
終了関数
それ以外
temparray(lineNum-1) = lineContent
終了する場合
tempcnt = join(temparray,chr(13)&chr(10))
set f = fso.createtextfile(server.mappath(ファイル名),true)
f.writetempcnt
終了する場合
f.閉じる
f = 何も設定しない
終了関数