AndrewHoward 0 Posted August 5, 2021 Hi, What's the equivalent of this code in C# ? procedure FetchFromIStream( myStream : TStream ; myIStream : IStream ) ; var TOS : TOLEStream ; begin TOS:=TOLEStream.Create(myIStream) ; try TOS.position:=0 ; myStream.position:=0 ; myStream.copyFrom(TOS,TOS.Size) ; myStream.Position:=0 ; TOS.position:=0 ; finally FreeAndNil(TOS); End ; end ; TIA Share this post Link to post
Remy Lebeau 1394 Posted August 6, 2021 (edited) There isn't one, at least not natively. You would have to write your own wrappers, either to wrap a myStream inside of an IStream and then call myIStream.CopyTo(), or else wrap myIStream inside of a System.IO.Stream and then call myStream.CopyTo(). A simpler way is to just call myIStream.Read() and myStream.Write() in a loop until there is nothing left to read from myIStream. No wrappers needed, just a local byte[] array. Edited August 6, 2021 by Remy Lebeau Share this post Link to post