Thema: Delphi read from multiple Files

Einzelnen Beitrag anzeigen

alzaimar
(Moderator)

Registriert seit: 6. Mai 2005
Ort: Berlin
4.956 Beiträge
 
Delphi 2007 Enterprise
 
#2

Re: read from multiple Files

  Alt 25. Mär 2009, 18:54
Hi,

I'm sorry, I don't know what you want. Your code sample does not show what you tried and what you want to achieve. Do you want to load the contents of many file into one stream? This can be achieved by adding the contents to the end of the memory stream.
Delphi-Quellcode:
Procedure AddFileToStream (aStream : TStream; aFile : String);
Var
  filestream : TFileStream;

Begin
  filestream := TFileStream.Create (aFile, fmOpenRead);
  Try
    aStream.CopyFrom (filestream, filestream.Size);
  Finally
    filestream.Free;
  End
End;
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.

HTH.
"Wenn ist das Nunstruck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput!"
(Monty Python "Joke Warefare")
  Mit Zitat antworten Zitat