CHR(3ast) CHR(3ast)

# [NAME](#NAME)

chr - character constant conversion routines

# [SYNOPSIS](#SYNOPSIS)

```
#include <ast.h>
int          chresc(const char* s, char** e);
int          chrtoi(const char* s);
```

# [DESCRIPTION](#DESCRIPTION)

chresc converts and returns the next character constant in the 0-terminated string *s*. If *e* is not 0 then *\*e* is set to point to the next character in *s* on return. 0 is returned and *e* is not modified when the end of *s* is reached.

chrtoi converts the 0-terminated string *s* to an *int* and returns the value. The characters in *s* are converted in order from the left and shifted into the *int* value until up to the number of characters in an *int* is reached. This operation is inherently machine-dependent, but at least it's defined in one place.

The following **\\** escape sequences are recognized:

\\*ooo*

The character represented by the octal code *ooo*.

\\x*xx*

The character represented by the hex code *xx*.

\\a

Alert (bell).

\\b

Backspace.

\\f

Formfeed.

\\n

Newline.

\\r

Carriage return.

\\t

Horizontal tab.

\\v

Vertical tab.

\\E

ESC (escape).

\\\\

Backslash.

Other characters following **\\** are undefined (although for backward compatibility they translate to themselves).

# [SEE ALSO](#SEE_ALSO)

[str(3)](/man/os/ksh/str.3)

---

Document: chr(3ast) from ksh 1.0.10-r37 (Chainguard OS)
Source: https://github.com/ksh93/ksh
