pues esta es mi aportacion.... (ya lo tenia en algun programita... (bueno, sin la restriccion de 5 lineas...
) )
Código Delphi
[-]
procedure TForm1.GuardarUltimaLinea(UltimaLinea:String);
var
texto : TStrings;
begin
texto:=TStringList.Create;
if (FileExists('c:\archivo_LOG.txt')) then
begin
texto.LoadFromFile('c:\archivo_LOG.txt');
if (texto.Count = 5) then
begin
texto.Delete(0);
texto.Add(UltimaLinea);
end
else
begin
texto.Add(UltimaLinea);
end;
texto.SaveToFile('c:\archivo_LOG.txt');
texto.Free;
end
else
begin
texto.Add(UltimaLinea);
texto.SaveToFile('c:\archivo_LOG.txt');
texto.Free;
end;
end;
salu2!!!!!!!
reduciendolo un poco...
Código Delphi
[-]
procedure TForm1.GuardarUltimaLinea(UltimaLinea:String);
var
texto : TStrings;
begin
texto:=TStringList.Create;
if (FileExists('c:\archivo_LOG.txt')) then
begin
texto.LoadFromFile('c:\archivo_LOG.txt');
if (texto.Count = 5) then
texto.Delete(0);
texto.Add(UltimaLinea);
texto.SaveToFile('c:\archivo_LOG.txt');
texto.Free;
end
else
begin
texto.Add(UltimaLinea);
texto.SaveToFile('c:\archivo_LOG.txt');
texto.Free;
end;
end;