Maybe easiest and safest is to make sure sizeof(gphoto_gimme_struct) is big enough to hold some maximum number of args by declaring it a fixed size:
#define MAXARGS 339966 t_atom argv[MAXARGS];
instead of
t_atom *argv;
and then copy up to MAXARGS atoms in a loop:
for (i = 0; (i < argc)&&(i < MAXARGS); ++i) threadargs->argv[i] = argv[i];
instead of
threadArgs->argv = argv;
...or you could leave the struct alone and separately allocate the precise amount of memory for argc atoms, as
threadArgs->argv = malloc(sizeof(*argv)*argc));
and then copy them over.
Martin
B. Bogart wrote:
Thanks Martin,
I can't get the syntax right, care to give me a hint?
B. Bogart
martin.peach@sympatico.ca wrote:
So what have I misunderstood?
argv is a pointer, it's size is 4. You're still not copying whatever argv is pointing to.
Martin
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev