MEMCHR(3POSIX)

πŸ’– MEMCHR(3POSIX) πŸ’–

okay bestie, welcome to the POSIX Programmer's Manual β€” this is memchr(3POSIX), and yes it's that manual, the POSIX one, not the Linux one. Come sit with me, we're gonna find a byte together ✨


🌸 PROLOG 🌸

so like, this manual page is part of the POSIX Programmer's Manual. Real talk: the Linux implementation of this interface may differ (so if you're on Linux, go consult the corresponding Linux manual page for the deets on Linux behavior), or the interface may not be implemented on Linux at all. no cap. πŸ‘‘


πŸŽ€ NAME πŸŽ€

memchr β€” find byte in memory


✨ SYNOPSIS ✨

#include <string.h>

void *memchr(const void *s, int c, size_t n);

πŸ¦‹ DESCRIPTION πŸ¦‹

The functionality described on this reference page is aligned with the ISO C standard. If there's any conflict between the requirements described here and the ISO C standard, that conflict is unintentional β€” no drama intended. This volume of POSIX.1‐2017 defers to the ISO C standard, periodt.

The memchr() function shall locate the first occurrence of c (converted to an unsigned char) in the initial n bytes (each interpreted as unsigned char) pointed to by s. it's giving "where u at, byte" πŸ”

Implementations shall behave as if they read the memory byte by byte from the beginning of the bytes pointed to by s and stop at the first occurrence of c (if it is found in the initial n bytes). so it's a lil walk-through, one byte at a time, and the second it spots c it's done. main character energy fr fr πŸ’…


πŸ’œ RETURN VALUE πŸ’œ

The memchr() function shall return a pointer to the located byte 🫢, or a null pointer if the byte is not found 😭.


πŸ’€ ERRORS πŸ’€

No errors are defined. iconic, honestly. nothing to report, we're unbothered.

The following sections are informative. (iykyk β€” informative means it's extra context, not requirements πŸ‘‘)


πŸ“ EXAMPLES πŸ“

None. yeah. nothing. empty. the void. πŸ•³οΈβœ¨


🌈 APPLICATION USAGE 🌈

None. also nothing! we're keeping it mysterious. πŸ™ˆ


⭐ RATIONALE ⭐

None. bestie the reasoning section said "no thoughts, head empty." 🧚


πŸ”₯ FUTURE DIRECTIONS πŸ”₯

None. the future is unwritten and this function is not about to write it. πŸ’…


πŸŽ€ SEE ALSO πŸŽ€

The Base Definitions volume of POSIX.1‐2017, <string.h> β€” go read that one next, it's the sibling page 🫢


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 β€” so like, if they disagree, the original wins, no debate. 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 .


okay that's the whole page bestie, every last crumb of it, nothing skipped, we ate and left no crumbs 🫢✨

IEEE/The Open Group β€” 2017 β€” MEMCHR(3POSIX). mwah, bye, go find ur bytes πŸ’–πŸŽ€πŸ¦‹