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

Yo sigo a lo mío...

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

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

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

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

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