WCSDUP(3POSIX)
π WCSDUP(3POSIX) π
okay bestie, welcome to the POSIX Programmer's Manual entry for wcsdup, no cap. this is the wide-character girlie of the family. let's get into it π«Ά
β¨ PROLOG β¨
real talk first, because this matters: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so like, go consult the corresponding Linux manual page for the deets on Linux behavior), or β plot twist β the interface might not even be implemented on Linux at all. π
πΈ NAME πΈ
wcsdup β duplicate a wide-character string. it's giving copy-paste but make it wide π
π SYNOPSIS π
#include <wchar.h>
wchar_t *wcsdup(const wchar_t *string);
π¦ DESCRIPTION π¦
so the wcsdup() function is literally the wide-character equivalent of the strdup() function. sisters. same energy, different width. β¨
the wcsdup() function shall return a pointer to a new wide-character string, allocated as if by a call to malloc(), and it's the duplicate of the wide-character string string. the returned pointer can be passed to free() β yes queen, you do have to clean up after yourself. and a null pointer is returned if the new wide-character string cannot be created. π
π RETURN VALUE π
upon successful completion, the wcsdup() function shall return a pointer to the newly allocated wide-character string. iconic. otherwise, it shall return a null pointer and set errno to indicate the error. not the glow-up we wanted, but ok. π
π ERRORS π
the wcsdup() function shall fail if:
ENOMEMβ memory large enough for the duplicate string could not be allocated. the allocation said "no β€οΈ" and honestly? relatable.
the following sections are informative.
π EXAMPLES π
None. (yes bestie, literally none. we move. π)
π APPLICATION USAGE π
for functions that allocate memory as if by malloc(), the application should release such memory when it is no longer required, by a call to free(). for wcsdup(), this is the return value β so like, the thing you gotta free is the pointer you got back. don't ghost it, free it. π«Ά
π§ RATIONALE π§
None. (nothing to explain, it just is. main character behavior honestly. β)
β FUTURE DIRECTIONS β
None. (the future is bright and unchanging β¨)
πΈ SEE ALSO πΈ
free()strdup()wcscpy()
the Base Definitions volume of POSIX.1β2017, <wchar.h>
π COPYRIGHT π
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, no crumbs left π
IEEE/The Open Group, 2017, WCSDUP(3POSIX) β mwah, signing off, stay allocated and always free yourself ππβ¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms