Technical Notes Database TN982D.txt VARIANT RECORD LONGINT TO BYTE AND WORD Category :Pascal Platform :All Product :Turbo Pascal 4.0+ Description: Q. How can I quickly change a Longint into two Words or four Bytes? A. With a variant record you can map a group of variables on the same memory and be able to view the variables in different ways. Here is a example: Program Variant; Type Forms = Record Case Integer Of 0:(L:LongInt); 1:(W1,W2: Word); 2:(B1,B2,B3,B4: Byte); End; Var Many:Forms; Begin With Many do Begin Many.L:=123456789; Writeln(' LongInt Value : ',L); Writeln(' Word Value : ',W1,' ',W2); Writeln(' Byte Value : ',B1,' ',B2,' ',B3,' ',B4); End End. Reference: 7/16/98 4:35:38 PM
Last Modified: 01-SEP-99