I narrowed the error down.

It seems to have something to do with the static declaration I'm using. I didn't think this is important:

static mystruct *myArray = (mystruct*)malloc(howManyItems*sizeof(mystruct));

If I remove "static", the script runs fine apart from that it's now storing ridiculous numbers in the array and I don't know where these numbers are coming from.

Is the array dynamically expanded by doing

howManyItems++;

?

Last edited by sdh309795gaas; 12/20/17 16:46.