WCSCPY(3POSIX)

πŸ’– WCSCPY(3POSIX) β€” the POSIX Programmer's Manual, bestie edition πŸŽ€

okay so before we even start, real talk about the PROLOG, because it's important and I'm not gonna gatekeep it from you:

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

like. it might not even exist on your Linux box. vibe check your system first, bestie. πŸ’…


✨ NAME ✨

wcpcpy, wcscpy β€” copy a wide-character string, returning a pointer to its end πŸ¦‹


🌸 SYNOPSIS 🌸

#include <wchar.h>

wchar_t *wcpcpy(wchar_t *restrict ws1, const wchar_t *restrict ws2);
wchar_t *wcscpy(wchar_t *restrict ws1, const wchar_t *restrict ws2);

two little icons, same job, slightly different glow-up at the end. iykyk. ✨


πŸ’œ DESCRIPTION πŸ’œ

first up, a note that only applies to wcscpy(): the functionality described on this reference page is aligned with the ISO C standard. any conflict between the requirements described here and the ISO C standard is unintentional. this volume of POSIX.1‐2017 defers to the ISO C standard. so like, ISO C is the main character here, fr fr.

now the actual tea β˜• β€” the wcpcpy() and wcscpy() functions shall copy the wide-character string pointed to by ws2 (including the terminating null wide-character code, not skipping the little guy 🌸) into the array pointed to by ws1.

and this next part is the part where you listen to me, okay? πŸ‘‘

  • the application shall ensure that there is room for at least wcslen(ws2)+1 wide characters in the ws1 array. not "probably". at least. count it.
  • the application shall also ensure that the ws2 and ws1 arrays do not overlap. like, personal space, bestie. respect it.
🚨 If copying takes place between objects that overlap, the behavior is undefined. that's not a vibe, that's chaos. don't do it. πŸ’€

πŸ”₯ RETURN VALUE πŸ”₯

  • the wcpcpy() function shall return a pointer to the terminating null wide-character code copied into the ws1 buffer. yes, it points at the end, it's giving "i'll walk you to the door" energy. πŸšͺ✨
  • the wcscpy() function shall return ws1. simple. iconic. the original. πŸ‘‘

and, crucially: No return values are reserved to indicate an error. so if you were waiting for a lil error code to come save you… she's not coming. πŸ™ˆ


🫢 ERRORS 🫢

No errors are defined.

the following sections are informative. (translation: the vibes are informational only, the requirements were up top πŸ’…)


🌈 EXAMPLES 🌈

None. literally nothing. empty. a clean slate. we move. 🧚


⭐ APPLICATION USAGE ⭐

None. also nothing. not me having nothing to say for once 😭


πŸŽ€ RATIONALE πŸŽ€

None. no thoughts, head empty, just standards. πŸ’œ


πŸ¦‹ FUTURE DIRECTIONS πŸ¦‹

None. the future is a mystery and she's not telling. ✨


πŸ‘‘ SEE ALSO πŸ‘‘

  • strcpy()
  • wcsdup()
  • wcsncpy()

and also: the Base Definitions volume of POSIX.1‐2017, <wchar.h> 🌸


okay this part is the legal bit and I'm keeping it exactly, no editing, because lawyers are the one audience you do not play with:

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!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ˜­πŸ”₯πŸ‘‘πŸŒˆβ­πŸ’€πŸ™ˆπŸ“πŸ§šπŸ’œ

this lil masterpiece comes to you from IEEE/The Open Group, dated 2017, and it lives under the name WCSCPY(3POSIX). go copy some wide strings responsibly, and remember: wcslen(ws2)+1. count it. periodt. πŸ’…βœ¨