Hola de nuevo.
La sugerencia del mensaje anterior soluciona el mensaje de error. Pero me quedé pensando que si tu intención es guardar la cadena textual al fin del archivo, ese código no te va a funcionar.
Hacelo de este modo:
Código Delphi
[-]
var
str : string;
i : Integer;
begin
str := ExtractFilePath( Application.ExeName ) + 'programa.exe';
with TFileStream.Create(str, fmOpenReadWrite) do
try
str := '{test}' + Edit1.Text + '{test}';
Seek(0, soFromEnd);
for i:= 1 to Length(str) do
Write(str[i], 1);
finally
Free;
end;
end;
O también podrías hacer:
Código Delphi
[-]
var
str : string;
vec : array[0..1024] of char;
begin
str := ExtractFilePath( Application.ExeName ) + 'programa.exe';
with TFileStream.Create(str, fmOpenReadWrite) do
try
str := '{test}' + Edit1.Text + '{test}';
Seek(0, soFromEnd);
StrPCopy(vec, str);
WriteBuffer(vec, Length(str));
finally
Free;
end;
end;
Saludos.
