Re:D3 How to open a file, write in it then close
Ralf,
you could use filestreams, e.g.
Var
fs: TFileStream;
patchtext, patchinfo: String;
offset: LongInt;
Begin
..assign values to patchtext etc.
fs:= TFileString.Create( exefilename,
fmOpenReadWrite or fmShareExclusive );
try
If fs.Size = expectedFilesize Then Begin
fs.Position := offset;
fs.Write( patchtext[1], Length(patchtext)+1 );
// writes string + following #0
.... etc.
End
finally
fs.free;
end;
Note that you cannot write to a running EXE in Win32, the file is kept open
by the OS as long as the program runs and cannot be written to.
Peter Below (TeamB) 100113.1...@compuserve.com)