You can tokenise it yourself by repeated calls to strstr. How about a simple function to wrap it up and handle NULL safely:
char *next_token( char *str, const char *tok )
{
if( str == NULL ) return NULL;
char *s = strstr(str, tok);
if( s == NULL ) return NULL;
*s = 0;
s += strlen(tok);
return s;
}
Then it's just:
char *string1 = str;
char *string2 = next_token( string1, "sep");
char *string3 = next_token( string2, "sep");
// etc...
But I'd be more inclined to use an array.
char * strings[6] = { str, 0 };
for( int i = 1; i < 6; i++ ) {
strings[i] = next_token( strings[i-1], "sep" );
}
[edit]
As the user unwind mentions in comments, you cannot tokenise a string literal like this. If you need to operate on string literals, then you need a tokenised that extracts substrings without modifying the original. That's an exercise for you. But if you want to get around it, just make your string a char array instead:
char str[] = "1000000sep0002006sep736794eesep13610015741sep-1seplocal";
You are allowed to modify that, because it's not a pointer to a string literal. Instead, it's an array that is initialised with a copy of a string literal.
Okay, I've said "string literal" enough times now...
strsep. Orstrtok. These are instring.h.strsep()is not a standard function (not in POSIX or C), but it may be quite widely available even so. It deals in single character delimiters, so it probably isn't appropriate here where you seem to have a 3-character delimiter. Also, arrays in C are indexed from 0 — you did mean to use an array, didn't you?strtok(). but using that function we can split it usingsinglecharacter.