The Open Group Base Specifications Issue 8
IEEE Std 1003.1-2024
Copyright © 2001-2024 The IEEE and The Open Group

NAME

memccpy — copy bytes in memory

SYNOPSIS

[XSI] [Option Start] #include <string.h>

void *memccpy(void *restrict
s1, const void *restrict s2,
       int
c, size_t n); [Option End]

DESCRIPTION

The memccpy() function shall copy bytes from memory area s2 into s1, stopping after the first occurrence of byte c (converted to an unsigned char) is copied, or after n bytes are copied, whichever comes first. If copying takes place between objects that overlap, the behavior is undefined.

The memccpy() function shall not change the setting of errno on valid input.

RETURN VALUE

The memccpy() function shall return a pointer to the byte after the copy of c in s1, or a null pointer if c was not found in the first n bytes of s2.

ERRORS

No errors are defined.


The following sections are informative.

EXAMPLES

None.

APPLICATION USAGE

The memccpy() function does not check for the overflow of the receiving memory area.

RATIONALE

None.

FUTURE DIRECTIONS

None.

SEE ALSO

XBD <string.h>

CHANGE HISTORY

First released in Issue 1. Derived from Issue 1 of the SVID.

Issue 6

The restrict keyword is added to the memccpy() prototype for alignment with the ISO/IEC 9899:1999 standard.

Issue 8

Austin Group Defect 448 is applied, adding a requirement that memccpy() does not change the setting of errno on valid input.

End of informative text.

 

return to top of page

UNIX® is a registered Trademark of The Open Group.
POSIX™ is a Trademark of The IEEE.
Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved
[ Main Index | XBD | XSH | XCU | XRAT ]