|
On Error GoTo ProcError_
Dim sFPathIn As String '入力ファイル
Dim sFPathOt As String '出力ファイル
Dim lFileLen As Long 'ファイル長
Dim iFileNo As Integer 'ファイル番号
Dim yBuf() As Byte 'バイト配列
'ファイル設定
sFPathIn = "d:\test\TestIn.txt"
sFPathOt = "d:\test\TestOt.txt"
'●入力データの読込
'入力ファイル長取得
lFileLen = FileLen(sFPathIn)
'バイト配列確保
ReDim yBuf(lFileLen - 1)
'ファイル番号取得
iFileNo = FreeFile
'入力ファイルオープン
Open sFPathIn For Binary As #iFileNo
'データ読込
Get #iFileNo, , yBuf
'入力ファイルクローズ
Close #iFileNo
'★3バイト目を編集(配列は0スタート)
yBuf(2) = "&HFF"
'●出力データ書込
'ファイル番号取得
iFileNo = FreeFile
'出力ファイルオープン
Open sFPathOt For Binary Access Write As #iFileNo
'データ書込
Put #iFileNo, , yBuf
'出力ファイルクローズ
Close #iFileNo
Exit Sub
|