Re: Using _Rreadk with PFs having multiple key fields defined

Barbara Morris <[email protected]> Tue, 16 Aug 2022 16:43:39 -0400
Newsgroups gmane.comp.lang.as400.c
Organization IBM
Message-ID <[email protected]>
On 2022-08-13 11:22 a.m., Patrik Schindler wrote:
> ... 
> One can include "key" as flag when referring to external defined files with #pragma mapinc. This results in a "_Packed struct" being defined for all key fields of the file in question. I was trying to typecast a char pointer to a variable of this type "_Packed struct …", but the compiler disallows this.
> ...

Can you show the code you're using to typecast the char pointer?

I'm not sure I'm doing the same thing you're trying to do, but I was 
able to do the following:

#pragma mapinc("test","BMORRIS/MAPINCF(REC)","key","")
#include "test"
main()
{
    BMORRIS_MAPINCF_REC_key_t keys;
    char *p;

    p = (char *)&keys;
}

I didn't get a _Packed struct though. I just got an ordinary struct.

 From the listing:
    typedef   struct {
       char K1[10];
       char K2[10];
    } BMORRIS_MAPINCF_REC_key_t;

-- 
Barbara

-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/c400-l.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com