FF00 - это уже далеко не байт а целое слово.
Как один из вариантов :
Код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | function File_ChangeByte(FileName : string ; NumByte : integer ; ByteVal : byte ) : boolean ;
Var
Yes : boolean ;
F : file of byte ;
begin
Result:= false ;
if NumByte>= 0 then begin
AssignFile(F,FileName);
{ $I -} reset(F) { $I +};
Yes:=(IoResult= 0 );
if Yes then begin
try
if NumByte<FileSize(F) then begin
{ $I -} seek(F,NumByte){ $I +};
Yes:=(IoResult= 0 );
if Yes then begin
{ $I -} write (F,ByteVal) { $I +};
Result:=(IoResult= 0 );
end ;
end ;
finally
{ $I -} CloseFile(F) { $I +};
Yes:=(IoResult= 0 );
end ;
end ;
end ;
end ;
|