On Fri, 9 Feb 2001, Oldham, Adam wrote:
Hello, I'm currently switching compilers from an old proprietary Pascal compiler to GPC. I've got a problem assigning a hex value to a character. This is easy in c, you can say char a ='0xa0'; and be done with it. The syntax for our old compiler was character := '/a0'; I've tried many things trying to assign a hex value to a character but have come up only the hex value of the first charcter: character := '/a0' results in 0x2f which is just the / character := '\a0' results in 0x5c which is the \ character := '16#a0' results in 0x31 which is the 1 character := '$82' results in 0x24, which is the $
I've tried all without the single quotes and get sytnax errors upon compile.
The function CHR works. A cast also works. Using hex values of q, r as an example:
program hex; var ch : char; begin ch := CHR(16#71); writeln( ch ); ch := char($72); writeln( ch ); end.
good luck Russ