Sorry to dig up a post that's been inactive for a month. I hope this doesn't count as resurrecting dead threads.

I'm currently working with string arrays myself in order to generate an onscreen-log for the server-side of my game. Although techmuc's post provided me with the solution to my problem, there seems to be a typo in it and I just want to spare anyone else finding this topic the headache.

malloc uses only one parameter and therefore you have to multiply the number of elements with sizeof(STRING*). The code below should be the correct one and is working in my scenario.

Code:
STRING** tst;
tst = malloc(sizeof(STRING*) * number of elements);
for(int i=0;i<number of elements;i++)
tst[i]=str_create("#number of characters");

//now you can access the string array like this:

str_cpy(tst[0],"hallo");


Last edited by Vorick; 02/26/09 10:59.

A8.10 Commercial