>> 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 ?
Anything in your records that is a reference type cannot be converted to a byte stream
for sending directly.
You should use shortstrings (which are not reference types) or use a class instead of a
record type and implement a SaveToStream, LoadFromStream type functions.
>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;
if the record being converted to a bytestream contains strings (long) or
reference types such as TObject references or PChars/Pointers then the resulting
record read in at the other end would be invalid as the referenced information
wasn't sent.
--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz