|Subject:||Re: TIdStream in Indy 9.17|
|Posted by:||Remy Lebeau (TeamB) (firstname.lastname@example.org)|
|Date:||Wed, 6 Apr 2005|
"sean buck" <sbu…@tcr.com> wrote in message
> I have been working with IdStream objects for the past
> couple of days, and I keep running into problems using them.
That is because you are not using it properly to begin with.
> In my code, I am declaring a variable as local to the procedure.
> I am setting it up with "stmEnvelope := TIdStream.create;".
You should not be creating new instances of TIdStream. It is specifically
designed to NOT be used that way. TIdStream is meant to be used only for
casting an existing TStream in order to gain access to new functionality
within actually using a new TStream object type. For example:
var Stream: TMemoryStream;
Stream := TMemoryStream.Create;
Line := TIdStream(Stream).ReadLn;
This works because TIdStream does not have any new data members of its own,
only methods, so the memory layout of the stream object does not change, and
the Self pointer inside the new methods is still valid.
TIdStream in Indy 9.17 posted by sean buck on Wed, 6 Apr 2005