All pastes #538276 Raw Edit

strtok

public text v1 · immutable
·published 2007-06-05 00:06 UTC
rendered paste body
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' ') && (string[index] > '\r'))
    {
	index++;
    }
    new offset = index;
    new result[30];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r'))
    {
	result[index - offset] = string[index];
	index++;
    }
    result[index - offset] = EOS;
    return result;
}