17 Feb, 2007, gazzy123 wrote in the 1st comment:
Votes: 0
Tried this function below to take a string and when len of the strings get to 59 then it would go on and save the rest data in strings[] array ina different number

someway it just chopps of the string[0] at the maxlen and doesn't save the rest into string[1]

could someone help me out ? :)
char *stringarray(char *string)
{
char * strings[10];
char buf[MSL];
char buf2[MSL];
char c;
int currlen=0;
int count=0;
int maxlen = 59;
char tempstring[MSL];

BN(buf);
BN(buf2);

mudstrlcpy(tempstring,string,sizeof(tempstring));

if (IS_NULLSTR(string))
return "";

int len = strlen(string);

for(int i=0;i<len;i++)
{
c = tempstring[i];
if (i<maxlen+currlen)
{
snprintf(buf2,sizeof(buf2),"%c",c);
mudstrlcat(buf,buf2,sizeof(buf));
BN(buf2);
continue;
}
currlen=i;
strings[count] = str_dup(buf);
bugf("%s %d",strings[count],count);
BN(buf);
count++;
}
return *strings;
}
0.0/1