All pastes #76687 Raw Edit

Stuff

public text v1 · immutable
·published 2006-07-02 00:03 UTC
rendered paste body
int
main()
{
	char 		*line_delimiter = "\r\n";
	char 		*word_delimiter = " ";
	char		*html_buf, *line_buf, *word_buf, ***tokens;
	int			**index;
	
	//struct tok temp_tok;
	//struct tok temp_tok_ptr;
	
	if ( (html_buf = malloc(BUF_APP_Q)) == NULL)
		err_sys("malloc error");
	strcpy(html_buf, "tirini  ta ta\r\nkeke\r\n");
	
	line_buf = strtok(html_buf, line_delimiter);
	while( line_buf != NULL ) {
		word_buf = strtok(line_buf, word_delimiter);
		while(word_buf != NULL) {
			printf("%s\n", word_buf);
			word_buf = strtok(NULL, word_delimiter);
		}
		printf("------------------\n");
		line_buf = strtok(NULL, line_delimiter);
	}
	
	exit(0);
}

output:
tirini
ta
ta
------------------