Re: Delphi.NET



"Daniel Hobson" <djhob1972@xxxxxxxxxxxx> schreef in bericht
news:tI3gi.91$iq2.28@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,

I was wondering if anybody is out there who uses Delphi.NET. We seem to
be having a few problems in knowning
about the new requirements of DotNET. The main one that has us really
stumped is how do you
convert from one data type to another different data type?

For example:-

Type
TTestRec = record
t1: array [1..32] of char;
t2: array [1..28] of char;
end;

MyBuffer : TidBytes;
MyActType : TTestRec;

I read in the information via TCP/IP into MyBuffer (Have no choice in the
matter)

The question is now .. how can I say that MyBuffer is type TTestRec ????


In a traditional Pascal sense you could use a variant record:
TTestRec = record
case proper: boolean of
true: ( t1: array [1..32] of char; t2: array [1..28] of char);
false: (test : array[1..60] of byte);
end;

Since you cannot use a fixed length array in the TCP/IP routine, combine
this with:
move(MyBuffer[0],MyActType.test[1],60);

MyActType.t1 and .t2 are accessible in the normal way and will contain the
respective parts of the buffer.
Tom


.



Relevant Pages

  • Delphi.NET
    ... about the new requirements of DotNET. ... convert from one data type to another different data type? ... MyActType: TTestRec; ... I read in the information via TCP/IP into MyBuffer ...
    (comp.lang.pascal.delphi.misc)
  • Re: Delphi.NET
    ... convert from one data type to another different data type? ... MyActType: TTestRec; ... I read in the information via TCP/IP into MyBuffer (Have no choice in the ... TidBytes is an array of bytes. ...
    (comp.lang.pascal.delphi.misc)
  • Delphi.NET
    ... about the new requirements of DotNET. ... convert from one data type to another different data type? ... MyActType: TTestRec; ... I read in the information via TCP/IP into MyBuffer (Have no choice in the ...
    (alt.comp.lang.borland-delphi)
  • Re: Delphi.NET
    ... MyActType: TTestRec; ... I read in the information via TCP/IP into MyBuffer ... What you're trying to do is get the contents of the MyBuffer array into the MyActType record. ...
    (comp.lang.pascal.delphi.misc)