Delphi-PRAXiS
Seite 4 von 4   « Erste     234   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Datei öffnen / Dateiname Teil variabel (https://www.delphipraxis.net/174987-datei-oeffnen-dateiname-teil-variabel.html)

Sir Rufo 23. Mai 2013 19:10

AW: Datei öffnen / Dateiname Teil variabel
 
Zitat:

Zitat von jigsawclan (Beitrag 1216249)
OK :)
Jetzt bin ich an dem Punkt angelangt wo es mir zuviel wird :P

Biete eine Kiste Bier ;) ;)

Eine Variable deklarieren ist zuviel? :shock:

Bist du dir sicher, dass du programmieren willst?

jigsawclan 23. Mai 2013 19:13

AW: Datei öffnen / Dateiname Teil variabel
 
Zitat:

Zitat von Sir Rufo (Beitrag 1216250)
Zitat:

Zitat von jigsawclan (Beitrag 1216249)
OK :)
Jetzt bin ich an dem Punkt angelangt wo es mir zuviel wird :P

Biete eine Kiste Bier ;) ;)

Eine Variable deklarieren ist zuviel? :shock:

Bist du dir sicher, dass du programmieren willst?

Muss ich darauf Antworten? :roll:

Sir Rufo 23. Mai 2013 19:34

AW: Datei öffnen / Dateiname Teil variabel
 
Delphi-Quellcode:
program DateienSuchen;

{$APPTYPE CONSOLE}
{$R *.res}

uses
  System.SysUtils;

type
  TDynStringArray = array of string;

function GetFileArray( const ASearchStr : string ) : TDynStringArray;
var
  LFileCount : Integer;
  LPath :     string;
  LSearchRec : TSearchRec;
begin
  LFileCount := 0;
  SetLength( Result, 10 );

  LPath := ExtractFilePath( ASearchStr );

  if FindFirst( ASearchStr, faAnyFile, LSearchRec ) = 0
  then
    try
      repeat

        if LSearchRec.Attr and faDirectory = faDirectory
        then
          Continue;

        if LFileCount > High( Result )
        then
          SetLength( Result, LFileCount + 10 );

        Result[LFileCount] := LPath + LSearchRec.Name;

        Inc( LFileCount );

      until FindNext( LSearchRec ) <> 0;

      SetLength( Result, LFileCount );
    finally
      FindClose( LSearchRec );
    end;
end;

procedure Test;
var
  LFiles : TDynStringArray;
  LIdx :  Integer;
begin
  LFiles := GetFileArray( 'C:\*.*' );

  for LIdx := Low( LFiles ) to High( LFiles ) do
    WriteLn( LFiles[LIdx] );
end;

begin
  try

    Test;

  except
    on E : Exception do
      WriteLn( E.ClassName, ': ', E.Message );
  end;

  ReadLn;

end.

jigsawclan 23. Mai 2013 19:42

AW: Datei öffnen / Dateiname Teil variabel
 
Danke. Ich werde mir das morgen mal alles durchschauen.
Wie gesagt bin ich ein wenig mit der Gesamtsituation überfordert :-D

Und jetzt noch der lange code :lol: muss das erst mal nachvollziehen was das ganze überhaupt macht


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:32 Uhr.
Seite 4 von 4   « Erste     234   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz