or, you at least need another index for the characters you put into packets. When you switch to a new x index, you need to reset the output index to 0.
void split(char *original)
{
int x = 0;
int i = 0;
int jj = 0;
while (original[i] != '\0')
{
if (original[i] == '@')
{
packets[x][jj] = '\0';
x++;
jj = 0;
}
else
{
packets[x][jj++] = original[i];
}
i++;
}
}
if the PA_WaitForVBL(); is necessary, what does it do?
Murtan
Practically a Master Poster
671 posts since May 2008
Reputation Points: 344
Solved Threads: 116
And don't forget to terminate the last token when break the loop...
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
char cmd[3]; // 3 byte array [0] [1] [2]
memcpy(cmd,packets,3); // cmd contains 'MSG' (confirmed)
if (cmd == "MSG") // not working
// try memcmp(cmd, "MSG", 3) == 0
{
PA_OutputText(1, 1, lineNum, packets); //show on DS screen
}
// not working either
// if the last one was cmd[2] it might work
if ((cmd[0] == "M") && (cmd[1] == "S") && (cmd[3] == "G"))
{
PA_OutputText(1, 1, lineNum, packets); //show on DS screen
}
Murtan
Practically a Master Poster
671 posts since May 2008
Reputation Points: 344
Solved Threads: 116