STRCAT(3POSIX)

πŸ¦‹ STRCAT β€” POSIX Programmer's Manual (bestie cut) πŸ’…

okay so real talk, this whole page comes from the POSIX Programmer's Manual, and the filename vibe is literally STRCAT(3POSIX). That's the whole header. Slay.


✨ PROLOG ✨

so like, 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 if you're on Linux, go read the corresponding Linux manual page for the actual tea on Linux behavior. Also possible: the interface just isn't implemented on Linux at all. πŸ’€ Not every platform shows up to the party.


πŸ‘‘ NAME πŸ‘‘

strcat β€” concatenate two strings. That's it. That's the job. She glues, she merges, she does NOT do it safely. 🫢


🌸 SYNOPSIS 🌸

#include <string.h>

char *strcat(char *restrict s1, const char *restrict s2);

πŸ’– DESCRIPTION πŸ’–

So the functionality described on this reference page is aligned with the ISO C standard. And like β€” if there's any conflict between what's written here and the ISO C standard? That was NOT intentional, ok, no cap. This volume of POSIX.1‐2017 defers to the ISO C standard. ISO is the main character here. πŸ‘‘

Now the actual function tea: strcat() shall append a copy of the string pointed to by s2 β€” including the terminating NUL character β€” to the end of the string pointed to by s1.

The initial byte of s2 overwrites the NUL character at the end of s1. She just stomps right over that NUL. Iconic. Rude. Both.

⚠️ And if copying takes place between objects that overlap, the behavior is undefined. Not "a little weird." Not "probably fine." UNDEFINED. Do not test her. 😭

⭐ RETURN VALUE ⭐

strcat() shall return s1. That's the whole return. And no return value is reserved to indicate an error β€” there is no special little error code hiding in here, bestie. No backup plan. 🌈


πŸŽ€ ERRORS πŸŽ€

No errors are defined.

πŸ“Œ the following sections are informative πŸ‘€

πŸ¦‹ EXAMPLES πŸ¦‹

None. (Yeah. She gave us nothing. Not one example. Ate and left no crumbs, truly.) πŸ™ˆ


πŸ’œ APPLICATION USAGE πŸ’œ

This version is aligned with the ISO C standard β€” and that does not affect compatibility with XPG3 applications. Reliable error detection by this function was never guaranteed. Never was. Never will be. Periodt. πŸ’…


🧚 RATIONALE 🧚

None.


🌈 FUTURE DIRECTIONS 🌈

None.


πŸ”₯ SEE ALSO πŸ”₯

  • strncat()
  • The Base Definitions volume of POSIX.1‐2017, <string.h>

okay legal moment, everybody hold hands 🫢

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.

And if there's 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. She calls the shots, fr fr. 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 .


✨ cute little sign-off ✨ this whole vibe check was brought to you by IEEE/The Open Group, 2017, and the page signature is literally STRCAT(3POSIX). mwah, bye bestie πŸ’‹πŸ¦‹