Ver Mensaje Individual
  #5  
Antiguo 12-02-2008
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.107
Reputación: 34
dec Tiene un aura espectaculardec Tiene un aura espectacular
Hola,

He descubierto que no estaba leyendo de los archivos sino una línea.

Código Delphi [-]
function ReadTextFiles(
 path, mask: string): string;

  function FileToStr(
   path: string): string;
  var
    line: string;
    aFile: TextFile;
  begin
    AssignFile(aFile, path);
    Reset(aFile);
    while not Eof(aFile) do
    begin
      ReadLn(aFile, line);
      result := result + line;
    end;
    CloseFile(aFile);
  end;

var
  sr: TSearchRec;
begin
  result := EmptyStr;
  path := ExtractFilePath(path);
  if FindFirst(path + mask,
   faAnyFile, sr) = 0 then begin
     try
       repeat
         result := result +
          FileToStr(path + sr.Name);
       until (FindNext(sr) <> 0);
     finally
       FindClose(sr);
     end;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Memo1.Text := ReadTextFiles('.\', '*.csv');
end;
__________________
David Esperalta
www.decsoftutils.com

Última edición por dec fecha: 12-02-2008 a las 19:26:09.
Responder Con Cita