strndup(3pub)

strndup3pub

Duplicate part of a string

Usage

#include <publib.h>
char *strndup(const char *str, size_t n);

Overview

strndup will make a duplicate of the n first characters of str, using malloc(3) to allocate memory for the duplicate. The caller is supposed to free the duplicate's memory when no longer needed.

Return value

strndup will return a pointer to the duplicate, or NULL if no memory could be allocated.

Releases

11 releases since Debian 1.2 (Rex); the text changed 4 times.

  1. 1.2–1.3
  2. 2.0–2.2
  3. 3.0
  4. 3.1–6.0
  5. 7–8

Author

Lars Wirzenius ([email protected])

From publib-dev 0.40-1 in Debian 8 (Jessie). Parsed by carta from the page's man source.