regerror()

Explain a regular expression error code

Synopsis:

#include <regex.h>

size_t regerror( int err, 
                 const regex_t * reg,
                 char * buf, 
                 size_t len );

Arguments:

err
The value returned by a previous call to regcomp() or regexec().
reg
A pointer to the regex_t object for the regular expression that you provided to the failed call to regcomp() or regexec().
buf
A pointer to a buffer where the function can store the explanation.
len
The length of the buffer, in characters.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Note: This function is in libc.a, but not in libc.so (in order to save space).

Description:

The regerror() function provides a string explaining an error code returned by regcomp() or regexec(). The string is copied into buf for up to len characters.

Returns:

The number of characters copied into the buffer.

Examples:

See regcomp().

Classification:

POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Contributing author:

Henry Spencer. For license information, see Licensing information in Typographical Conventions, Support, and Licensing.