James Sugrue <[EMAIL PROTECTED]> wrote on 11/06/2001
15:40:12:
>
>Excuse me for being a bit slow 2day (due to a 4:30am start coz of
>Canadian GP), but how do I do this in code.
<snip>
I'm a C++ programmer, but I'll have a go. No doubt someone will
correct me if I get something wrong (like the pointers - never did
really get those when I was programming in Pascal <G>).
>How do I do below in Delphi ??
>
>union trans_
>{
> unsigned char data[TRANS_LEN];
> struct trs_general_ general;
> struct trs_plu_sale_ plu_sale;
> struct trs_discount_ discount;
>}
type
trans_ = record
case integer of
0 : data : array[0..TRANS_LEN-1] of byte;
1 : general : trs_general_;
2 : plu_sale : trs_plu_sale_;
3 : discount : trs_discount_;
end;
end;
>then
>
>union trans_ TrsBuf;
var
TrsBuf : trans_;
>switch (TrsBuf.general.OpCode)
>{
> case TRANS_PLU_SALE:
> TreatPLUSale(&TrsBuf.plu_sale);
> break;
> case TRANS_DISCOUNT:
> TreatDiscount(&TrsBuf.discount);
> break;
>}
case TrsBuf.general.OpCode of
TRANS_PLU_SALE:
TreatPLUSale(^TrsBuf.plu_sale);
TRANS_DISCOUNT:
TreatDiscount(^TrsBuf.discount);
end;
--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur!"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"