Hello,
I need to decode certain packets which I need to split first. They are splitted using '@@@' (in this example I only use one '@').
I'm having this code now: (It's basic C code for a NDS platform)
char buf2[256] = "test1@test2@test3@";
char packets[30][256];
int main(int argc, char ** argv)
{
split(buf2);
//here show code for NDS
}
void split(char *original)
{
int x = 0;
int i = 0;
while (original[i] != '\0')
{
if (original[i] == '@')
{
packets[x][i] = '\0';
x++;
}
else
{
packets[x][i] = original[i];
}
i++;
PA_WaitForVBL();
}
}
Result:
packets[0] = 'test1'
packets[1] = (nothing)
packets[2] = (nothing)
What am I doing wrong? [1] and [2] should be filled too I guess!
Thanks in advance.