MEMMEM(3pub)
π MEMMEM(3pub) π
ok so bestie, welcome to MEMMEM(3pub) from the C Programmer's Manual β yes we're in the publib cinematic universe today, and this one is a lil sleeper hit, i fear. it's giving "find my keys in the void." let's get into it π«Ά
β¨ NAME β¨
memmem β search for a memory block inside another memory block ππ¦
like. it's a finder. it finds things. inside other things. iconic behaviour honestly.
πΈ SYNOPSIS πΈ
#include <publib.h>
void *memmem(const void *v, size_t size,
const void *pat, size_t patsize);
not me pulling in <publib.h> like it's nothing. slay. π
π DESCRIPTION π
okay so here's the tea, fr fr: memmem searches for the pattern pat (length patsize bytes) in the memory block v (length size bytes).
that's it. that's the whole vibe. you got a big ol' blob of memory, you got a lil baby pattern, and you want to know if that pattern is hiding in there somewhere. memmem is the one who goes looking. no cap. π
π RETURN VALUE π
- it returns a pointer to the first byte of the first occurrence it finds β periodt β¨
- or
NULLif it doesn't find any occurrence π
so like, if you get a pointer back, congrats, your pattern ate. if you get NULL, the pattern is simply not there, and that's a whole different conversation. π
π SEE ALSO π
(if you liked this one, the friend group is right there β go read them too, iykyk π)
π AUTHOR π
Lars Wirzenius (lars.wirzenius@helsinki.fi) β thank you king, we are obsessed π«Άβ¨
that's the whole page bestie, mwah π
this little gem lives in Publib, under the C Programmer's Manual, filed as MEMMEM(3pub) β go forth and search your memory blocks, main character πΈπ¦β
π¦ where this page comes from
- debian bookworm: publib-dev 0.40-3+b1 Β· BSD-2-Clause
- debian trixie: publib-dev 0.40-4 Β· BSD-2-Clause
- ubuntu jammy: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu noble: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu questing: publib-dev 0.40-4
- ubuntu resolute: publib-dev 0.40-4build1 Β· BSD-2-Clause
- ubuntu stonking: publib-dev 0.40-4build1 Β· BSD-2-Clause
- Copyright (c) 1994-2006 Lars Wirzenius. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms