Re: Command Parameter Variable Character field
Scott Klement <[email protected]> Fri, 26 Apr 2019 16:42:12 -0500
| Newsgroups | gmane.comp.lang.as400.c |
|---|---|
| Message-ID | <[email protected]> |
Hi Spencer,
On 4/26/2019 3:54 PM, Spencer Elliott wrote:
> I have examined the input (argv[n]) field in my program and it appears that 2 integers preceded the data.
[SNIP]
> PARM KWD(MONPATH) TYPE(*CHAR) LEN(128) MIN(1) ALWUNPRT(*NO) +
> ALWVAR(*YES) VARY(*YES *INT4)
>
I did not have the problem you describe... I only had one integer, the
one that contains the parameter length. Here's the ILE C program I used
to test:
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
typedef struct varchar128_t {
int len;
char value[128];
} varchar128;
char buf[129];
varchar128 *monpath = (varchar128 *)argv[1];
printf("monpath->len = %d\n", monpath->len);
memset(buf, '\0', sizeof(buf));
memcpy(buf, monpath->value, monpath->len);
printf("monpath->value = %s\n", buf);
return 0;
}
--
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