Next: , Previous: tokcmp, Up: Strings   [Contents]


4.26 tokqsplit

split a string into tokens

Synopsis

#include <suplib/str.h>

int tokqsplit(
  char *str,
  char *tok[],
  const char *delim,
  int ntok,
  int split
);

Parameters

char *str

the string to split up

char *tok[]

the array that will receive the tokens

const char *delim

the delimiters to split on

int ntok

the maximum number of tokens to read

int split

the strtokq split argument

Description

tokqsplit splits a string into a series of tokens using str_tokq. It fills a caller provided array with pointers to the tokens. The caller should specify the maximum number of tokens to read.

Returns

It returns the actual number of tokens in the string, which may differ (either greater and lesser) than the number requested. Upon error, it returns ‘-1’.

Author

Diab Jerius