Thanks Nic, that looks good. I will have to try it out later...
Thanks, Jeremy Coulter
-----Original Message-----
From: Nic Wise [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 14, 1999 9:28 AM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Passing record structures
Jeremy Coulter wrote:
> Yeah well, I am way ahead of you here Dennis.
> I have an app that it already communicating via TCP/IP fine, but it is
> passing strings....as it is a proto type.
> I now want to step it up a notch, and start getting some structure to the
> way things happen, and thought a record structure is one of the best ways
of
> adding structure to data. (kind of)
>
> I am using strings in my records, but I guess I can change it to a PChar.
>
> so how do I treat it as a memory block ?
Type cast it to an array is one way:
Type
TBigArray = array[0..10000] of byte;
RecSize := SizeOf(Rec);
HandleItSomeHow(@Rec,RecSize);
procedure HandleItSomeHow(Var Rec; Size : Longint);
Var
S : String; //make sure its a LONG string
begin
SetLength(S,Size);
Move(rec,@s[1],size);
StreamStringOverNetwork(s);
end;
Or something like that. Dunno how it would handle nulls, but it
should.....
N
--
Nic Wise - Inprise New Zealand Ltd. [EMAIL PROTECTED]
09-360-0231 (wk), 021-676-418 (mob), [EMAIL PROTECTED] (hm)
My opinions do not reflect the opinions of my employer,
or myself at times.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz