MEMSET_S(3C) | Standard C Library Functions | MEMSET_S(3C) |
memset_s
— copy a
value to all bytes of a memory buffer
Standard C Library (libc, -lc)
#define __STDC_WANT_LIB_EXT1__ 1
#include
<string.h>
errno_t
memset_s
(void *s,
rsize_t smax, int c,
rsize_t n);
The
memset_s
()
function copies the value of c (converted to an
unsigned char) into each of the first
n bytes of the memory buffer pointed to by
s.
Unlike the
memset(3C),
memset_s
()
is guaranteed to never be optimized away by the compiler.
The
memset_s
()
function detects the following runtime-constraint violations:
NULL
pointer.RSIZE_MAX
.If runtime-constraint violation is detected, and
if s and smax are valid, the
memset_s
()
function copies the value of c (converted to an
unsigned char) into each of the first
smax bytes of the memory buffer pointed to by
s before calling the runtime-constraint handler.
The memset_s
() function returns 0 if there
was no runtime-constraint violation. Otherwise, a non-zero value is
returned.
The memset_s
() function conforms to
ISO/IEC 9899:2011
(“ISO C11”).
August 12, 2017 | OmniOS |