Skip to content

Instantly share code, notes, and snippets.

/Strtok Secret

Created August 11, 2013 07:57
Show Gist options
  • Save anonymous/020d6e1c6d2b4f978808 to your computer and use it in GitHub Desktop.
Save anonymous/020d6e1c6d2b4f978808 to your computer and use it in GitHub Desktop.
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment