WCSCPY(3P)

πŸ’– WCSCPY(3P) β€” bestie's guide to the POSIX Programmer's Manual πŸ’–

okay so this page is WCSCPY(3P), and it lives in the POSIX Programmer's Manual (yes, that whole volume, she's iconic). buckle up bestie, we're copying wide-character strings and we're gonna have fun doing it πŸ¦‹


🌸 PROLOG 🌸

heads up 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, consult the corresponding Linux manual page for the deets on Linux behavior β€” or honestly the interface might not even be implemented on Linux at all. πŸ’€ no cap, check your system.


✨ NAME ✨

wcpcpy, wcscpy β€” copy a wide-character string, and return a pointer to its end. it's giving "copy and also tell you where you ended up" 🫢


πŸŽ€ 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);

look at those restrict qualifiers. main character energy fr fr. ✨


πŸ‘‘ DESCRIPTION πŸ‘‘

for wcscpy() specifically: 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 if they ever beef, ISO C wins. periodt.

The wcpcpy() and wcscpy() functions shall copy the wide-character string pointed to by ws2 (including the terminating null wide-character code) into the array pointed to by ws1. like, the whole thing. null terminator included, she comes along for the ride πŸ’…

The application shall ensure that there is room for at least wcslen(ws2)+1 wide characters in the ws1 array, and that the ws2 and ws1 arrays do not overlap.

⚠️ If copying takes place between objects that overlap, the behavior is undefined. not "kinda weird", not "a little glitchy" β€” undefined. do not do this. i'm begging. 😭

🌈 RETURN VALUE 🌈

  • The wcpcpy() function shall return a pointer to the terminating null wide-character code copied into the ws1 buffer. she points at the end, like "you're done, bestie, here's the finish line" 🏁
  • The wcscpy() function shall return ws1. that's it, that's the return value, she just hands you back your own buffer.

No return values are reserved to indicate an error. so like, don't go looking for an error signal in the return value, there isn't one 🫠


πŸ’€ ERRORS πŸ’€

No errors are defined.

The following sections are informative. (translation: the rest of this is vibes and context, not requirements ✨)


πŸ“ EXAMPLES πŸ“

None. iconic of her honestly, no example, no notes.


🧚 APPLICATION USAGE 🧚

None. she said "you got this, figure it out" πŸ’œ


⭐ RATIONALE ⭐

None. no reasoning given, it just is. queen behavior.


πŸ”₯ FUTURE DIRECTIONS πŸ”₯

None. the future is unspecified and honestly? same.


πŸ¦‹ SEE ALSO πŸ¦‹

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

The Base Definitions volume of POSIX.1‐2017, <wchar.h> πŸ“š


okay legal moment, don't skip this, 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, and the manual page WCSCPY(3P) β€” go forth, copy your wide-character strings, respect the overlap warning, and slay πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from