All pastes #140932 Raw Edit

Untitled

public text v1 · immutable
#140932 ·published 2006-08-20 19:17 UTC
rendered paste body
char *strsplit(const char *str, char splitchar, int token_num)
{
	char *start = str;
	char *end;
	while(token_num && *start != '\0')
	{
		if(*start == splitchar)
			token_num--;
		start++;
	}

	end = start;
	while(*end != '\0' && *end != splitchar)
		end++;
	
	posix_strncpy(tmpbuf, start, end - start - 1);
	return tmpbuf;
}