memset_pattern(3)

memset_pattern3

Memset of a multi-byte pattern

Usage

#include <string.h>

void

memset_pattern4(void *b, const void *pattern4, size_t len);

void

memset_pattern8(void *b, const void *pattern8, size_t len);

void

memset_pattern16(void *b, const void *pattern16, size_t len);

Library

Standard C Library (libc, -lc)

Overview

These are analogous to memset(), except that they fill memory with a replicated pattern either 4, 8, or 16 bytes long. b points to a buffer of size len bytes which is to be filled. The second parameter points to the pattern. If the buffer length is not an even multiple of the pattern length, the last instance of the pattern will be truncated. Neither the buffer nor the pattern pointer need be aligned.

Examples

The following example:

char buf[10];
memset_pattern4( buf, "1234", sizeof(buf) );

will set the buffer to the value "1234123412".

Releases

Unchanged in 115 releases since Mac OS X 10.5.

  1. 10.5–26.5

History

These functions first appeared in Mac OS 10.5.

From Libc 1752.120.2 in macOS 26.5. Parsed by carta from the page's mdoc source.