Re: Delphi.NET
- From: "Tom de Neef" <tdeneef@xxxxxxxx>
- Date: Tue, 26 Jun 2007 15:51:22 +0200
"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
.
- Follow-Ups:
- Re: Delphi.NET
- From: Rob Kennedy
- Re: Delphi.NET
- From: Daniel Hobson
- Re: Delphi.NET
- References:
- Delphi.NET
- From: Daniel Hobson
- Delphi.NET
- Prev by Date: Re: Delphi.NET
- Next by Date: Re: Delphi.NET
- Previous by thread: Re: Delphi.NET
- Next by thread: Re: Delphi.NET
- Index(es):
Relevant Pages
|