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.
Any suggestions?
Thanks, Adam Oldham
----------------------------------------------------------------------- C. Adam Oldham Marconi Commerce Systems Inc. Software Engineer 7300 West Friendly Ave. adam.oldham@marconi.com Greensboro, NC 27420-2087 Phone : 336.547.5952 Fax : 336.547.5079 ----------------------------------------------------------------------- This document contains confidential information of Marconi Commerce Systems Inc. In consideration of the receipt of this document, the recipient agrees not to reproduce, copy, use or transmit this document and/or the information contained herein, in whole or in part, or to suffer such actions by others, for any purpose except with written permission, first obtained, of Marconi Commerce Systems Inc., and further agrees to surrender the same to Marconi Commerce Systems Inc. upon demand. -----------------------------------------------------------------------
On Friday 09 February 2001 3:54 pm, 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
I think what you want is CHR(16#a0).
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