AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

read from multiple Files

Ein Thema von mohfa · begonnen am 25. Mär 2009 · letzter Beitrag vom 26. Mär 2009
 
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.378 Beiträge
 
Delphi 12 Athens
 
#3

Re: read from multiple Files

  Alt 25. Mär 2009, 18:06
Zitat von alzaimar:
Btw: In your code sample, you don't have to set any of the 'Size' or 'Position' properties. This is done by the constructor and the CopyFrom method, by setting the Size-parameter to 0.
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
          //FS.Position := 0;
          //MS.Position := 0;
          MS.CopyFrom(FS, FS.Size);
        finally
          FS.Free;
        end;
      finally
        MS.Free;
      end;
    end;
  end;
Zitat:
Delphi-Quellcode:
MyStringList:=TStringList.Create;
// string list contains no files. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
For i:=0 to MyStringList.count-1 do
  if FileExists(MyStringList[i]) then
Delphi-Quellcode:
MS := TMemoryStream.Create;
try
  For i:=0 to MyStringList.Count-1 do
    if FileExists(MyStringList[i]) then
    begin
      FS := TFileStream.Create(MyStringList[i], fmOpenRead or fmShareDenyNone);
      try
        MS.CopyFrom(FS, FS.Size);
      finally
        FS.Free;
      end;
    end;
  ...
finally
  MS.Free;
end;
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:53 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz