The problem is that you want to keep some delimiters (like the special characters), but not others (like spaces). I would write my own function for this.
Code:
char buffer[100];
unsigned int buffer_index = 0;
for(const char* p = string_to_parse; *p; ++p)
{
switch(*p)
{
case '<':
case '>':
case '|':
case '&':
if(buffer_index > 0)
{
buffer[buffer_index] = '\0';
create_string_token(buffer);
buffer_index = 0;
}
create_char_token(*p);
break;
case ' ':
buffer[buffer_index] = '\0';
create_string_token(buffer);
buffer_index = 0;
break;
default:
/* Normal character */
buffer[buffer_index++] = *p;
}
}
This should give you an idea where to start. It parses through the string looking for tokens. You still need to take the token characters and strings, and add them to your completed array. The code above should only be used as a blueprint; it's probably buggy