Returns a pointer to a duplicate string of specified length.
char* INKstrndup (const char
*
str
, int
length
)
is a pointer
to the string to duplicate.str
is the
length of the string to duplicate.length
Returns a pointer to a new string that's a duplicate of
the string pointed to by
that is
str
bytes long. The
new string will be null-terminated. This API is very useful for
transforming non-null terminated string values (returned by APIs
such as length
INKMimeHdrFieldStringValueGet
) into
null-terminated string values. The memory for the new string is
allocated using INKmalloc
and should be
freed by a call to INKfree
.
A pointer to the duplicated string.
Note | |
---|---|
A valid null-terminated string may not be returned if
the input |