(char *)(ASCB + 0x6C) is going to add 0x6c * 4 since ASCB is a pointer to 
integer, then that will be recast to a char *.
(char *)ASCB + 06C will add 0x6c.

Define everything as unsigned char *, since that's what you're really pointing 
to.  Then recast to int or whatever when and as actually used.


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Barkow, Eileen
Sent: Thursday, February 08, 2018 11:14
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C

I tried the simplest solution of casting ASXB to a  CHAR * since I am not 
familiar with templates and  basically got the same value as before.
I will try some of the other solutions .

                            Thanks everyone  $ jn2 ASCB = FB7A00 ASXBC =  FB7BB0

********************
int *PSA;
 int      *ASCB;
 int      *ASXB=nullptr;
 char     *ASXBC;
 char jobnameÝ9¨;
 PSA=(int *)0x224; /* address of PSAAOLD */  ASCB=(int *)*PSA;  printf("ASCB = 
%X\n",ASCB);  ASXBC= (char *)(ASCB + 0x6c);  printf("ASXBC =  %X\n",ASXBC);

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Paul Gilmartin
Sent: Thursday, February 08, 2018 12:39 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Silly C problem adding hex 6C

On Thu, 8 Feb 2018 10:22:40 -0600, Allan Kielstra wrote:

>The size of a char in 1 byte.  Try
>
>(char *) ASXB = (char *) ASCB + 0x6c;  /* lazy version */
>
ANSI says a cast may not be used as an L-value.  IBM's C compiler enforces 
this.  I once did something like (IIRC?):
    *(char * *) ASXB += 0x6c;

My head hurts.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN


________________________________

This e-mail, including any attachments, may be confidential, privileged or 
otherwise legally protected. It is intended only for the addressee. If you 
received this e-mail in error or from someone who was not authorized to send it 
to you, do not disseminate, copy or otherwise use this e-mail or its 
attachments. Please notify the sender immediately by reply e-mail and delete 
the e-mail from your system.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to