#include <sys/types.h>
#include <regex.h>
size_t regerror(int errcode,
const regex_t *preg, char *errbuf,
size_t errbuf_size);
The regerror() function provides a mapping from error
codes returned by regcomp() and
regexec() to unspecified printable strings. It
generates a string corresponding to the value of the errcode
argument, which must be the last nonzero value returned by
regcomp() or regexec() with the given
value of preg. If errcode is not such a value,
the content of the generated string is unspecified.
If preg is a null pointer, but errcode is a
value returned by a previous call to regexec() or
regcomp(), the regerror() still generates
an error string corresponding to the value of errcode, but
it might not be as detailed under some implementations.
If the errbuf_size
argument is not 0, regerror() places the generated
string into the buffer of size errbuf_size bytes pointed
to by errbuf. If the string (including the terminating
null) cannot fit in the buffer, regerror() truncates
the string and null-terminates the result.
If errbuf_size is 0, regerror()
ignores the errbuf argument, and returns the size of the
buffer needed to hold the generated string.
- errcode
-
Is the last nonzero value that regcomp() or
regexec() returns.
- preg
-
Points to the given value in errcode.
- errbuf
-
Points to the errbuf_size parameter.
- errbuf_size
-
If not zero, indicates the place where regerror()
places the generated string into the errbuf_size-byte
buffer that errbuf points to. If the size is zero,
regerror() ignores this parameter and returns an
integer value.
If successful, the regerror()
function returns the size of the buffer needed to hold the entire
generated string, including the null termination. If the return
value is greater than errbuf_size, the string returned in
the buffer that errbuf points to has been truncated.
POSIX.2 (1996)
MT-Safe.
None.
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
- Functions:
- regcomp(), regexec(), regfree()
MKS Toolkit 9.2 Documentation Build 16.