Thema: Delphi read from multiple Files

Einzelnen Beitrag anzeigen

mohfa

Registriert seit: 11. Feb 2007
97 Beiträge
 
Delphi 7 Enterprise
 
#1

read from multiple Files

  Alt 25. Mär 2009, 18:23
Hi every body .

I have this Code :

Delphi-Quellcode:
Procedure Load(const AFilename: String);
var
  MS : TMemoryStream;
  FS : TFileStream;

begin

    if FileExists(AFilename) then
    begin
      MS := TMemoryStream.Create;
      try
        FS := TFileStream.Create(AFilename, fmOpenRead or fmShareDenyNone);
        try
          MS.Size := FS.Size;
          FS.Position := 0;
          MS.Position := 0;
          MS.CopyFrom(FS, 0);
        finally
          FS.Free;
        end;
      finally
        MS.Free;
      end;
    end;
  end;
This Loads only One File into FS ;

But if i want to load many files into FS how does it be possible ???

i tried to do the Following :

Delphi-Quellcode:
Procedure Load(const AFilename: String);
var
  MS : TMemoryStream;
  FS : TFileStream;
MyStringList:TStringList;
i:integer;
begin
MyStringList:=TStringList.Create;
For i:=0 to MyStringList.count-1 do
if FileExists(MyStringList[i]) then
.
.
.
.
But it doesn't work


Many thanks
  Mit Zitat antworten Zitat