Ver Mensaje Individual
  #7  
Antiguo 08-08-2008
jandok238 jandok238 is offline
No confirmado
 
Registrado: ago 2007
Ubicación: ¿ǝɯ dlǝɥ noʎ uɐɔ 'ʍouʞ ʇ,uop ı
Posts: 415
Reputación: 0
jandok238 Va por buen camino
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;

Última edición por jandok238 fecha: 08-08-2008 a las 00:32:10.
Responder Con Cita