strndup

Name

strndup -- return a malloc'd copy of at most N bytes of STRING

Synopsis

#include <string.h>

extern char *strndup(const char *string, size_t n);

Description

Return a malloc'd copy of at most N bytes of STRING. The resultant string is terminated even if no null terminator appears before STRING[N].