MEMCCPY(3P)

πŸ¦‹ MEMCCPY(3P) β€” bestie edition πŸ¦‹

okay so this page lives in the POSIX Programmer's Manual, it's MEMCCPY(3P), and it's serving you the whole memccpy() situation. ✨

πŸ’« PROLOG πŸ’«

Real talk before we even start: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may not be implemented on Linux at all. πŸ™ˆ iykyk.


🌸 NAME 🌸

memccpy β€” copy bytes in memory. that's it. that's the whole vibe. πŸ’…

✨ SYNOPSIS ✨

#include <string.h>

void *memccpy(void *restrict s1, const void *restrict s2,
    int c, size_t n);

πŸŽ€ DESCRIPTION πŸŽ€

So the memccpy() function shall copy bytes from the memory area s2 into s1, and it stops after the first occurrence of byte c (converted to an unsigned char, bestie, don't forget) gets copied β€” OR after n bytes are copied. whichever one comes first, periodt. 🫢

⚠️ and if copying happens between objects that overlap? the behavior is undefined. no cap, don't do it. πŸ’€

πŸ¦‹ RETURN VALUE πŸ¦‹

memccpy() shall return a pointer to the byte after the copy of c in s1. 🌈 or it returns a null pointer if c was not found in the first n bytes of s2. that's the tea. πŸ“

πŸ’œ ERRORS πŸ’œ

No errors are defined. iconic of it honestly.

The following sections are informative. (aka: cute bonus lore, not rules.)

🧚 EXAMPLES 🧚

None. literally none. nothing to see here bestie. 😭

⭐ APPLICATION USAGE ⭐

Heads up: the memccpy() function does not check for the overflow of the receiving memory area. so like. that's on you. be careful. πŸ™

🌈 RATIONALE 🌈

None.

πŸ‘‘ FUTURE DIRECTIONS πŸ‘‘

None.

πŸ”₯ SEE ALSO πŸ”₯

The Base Definitions volume of POSIX.1‐2017, <string.h> β€” go read that one too, it's giving supporting character energy but it matters. πŸ’–

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page, bestie 🫢 brought to you by IEEE/The Open Group, 2017 β€” MEMCCPY(3P), signing off. mwah. πŸ’…βœ¨

πŸ“¦ where this page comes from