---
name: "tokens_parse"
section: "3abz"
platform: "linux"
package: "libabz0-dev"
version: "0.5.1"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/tokens_parse"
---

# tokens\_parse(3abz)

parse strings and split them into tokens

## NAME

tokens\_parse, tokens\_destroy - parse strings and split them into tokens

## LIBRARIES

Abz Library (-labz), Debug Library (-ldebug)

## SYNOPSIS

```
#include <abz/tokens.h>
#include <abz/error.h>

int tokens_parse(struct tokens *tokens, const char *str);
void tokens_destroy(struct tokens *tokens);
```

## DESCRIPTION

The **tokens\_parse()** function converts a string to a tokens structure which is defined in *\<abz/tokens.h\>* as follows:

```
struct tokens
{
	int argc;
	char **argv;
};
```

Each argument consists of non-whitespace characters or characters between double quotes ("). The **tokens\_destroy()** function free memory allocated by the **tokens\_parse()** function.

## RETURN VALUE

The **tokens\_parse()** function returns 0 if successful or -1 if some error occurred. Call **abz\_get\_error()** to see what error occurred.

## NOTES

None of the libabz routines are thread-safe. I'm not planning to change this either! For more information, please see http://threading.2038bug.com/

## SEE ALSO

abz\_get\_error(3)

## AUTHOR

Written by Abraham vd Merwe \<abz@blio.com\>
