Using struct in the cast resolved the issue Where buffer char[1200] Where struct record { ... ... }; Struct record *recordptr;
recordptr = (struct record *)&buffer; > On Sep 26, 2019, at 1:11 PM, retired mainframer <retired-mainfra...@q.com> > wrote: > > Maybe you would like to show us some real code? > >> -----Original Message----- >> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On >> Behalf Of Joseph Reichman >> Sent: Thursday, September 26, 2019 8:40 AM >> To: IBM-MAIN@LISTSERV.UA.EDU >> Subject: casting with XL C\C++ compiler >> >> Hi >> >> Seems like a lot the casting I was able to do with the Visual Studio C\C++ >> compiler I am not able to do with XL C\C++ compiler >> >> A specific case struct * pointer the I would like to assign a char[1200] >> via Struct pointer * >> >> Buffer char[1200] > > This should have generated an error also. Perhaps you meant > char Buffer[1200]; > >> pointer = (pointer)&buffer; generates an error > > Assuming that you simply omitted the definition of pointer, something like > struct x *pointer; > then the assignment would look like > pointer = (struct x*)Buffer; > > While the & doesn't hurt in this case, it is superfluous because Buffer is > an array. But since C is case sensitive, buffer is completely different > from Buffer. > >> any guidance appreciated > > ---------------------------------------------------------------------- > 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