buffer_peek(3)
π¦ buffer_peek(3) π¦
okay bestie, sit down, hydrate, and let me tell you about buffer_peek β it lives in the Library Functions Manual and it is exactly the lowkey hero you want when you're reading stuff out of a buffer. π
β¨ NAME β¨
buffer_peek β return pointer to string in buffer πΈ
β¨ SYNTAX β¨
first things first, you gotta pull in the header, no cap:
#include <libowfat/buffer.h>
char* buffer_peek(buffer* b);
β¨ DESCRIPTION β¨
so here's the whole vibe: buffer_peek returns a pointer to the first byte of the string in the buffer. that's it. that's the function. it's giving "here, hold this pointer" and honestly? iconic. π
β¨ EXAMPLE β¨
not me about to show you the cutest little reading loop ever π«Ά β buffer_feed, buffer_peek and buffer_seek can be used together for efficient reading loops, nearly the same speed as calling op directly:
for (;;) {
r = buffer_feed(&b);
if (r <= 0) return r;
x = buffer_peek(&b);
dosomething(x,r);
buffer_seek(&b,r);
}
look at that. peek, do the thing, seek. the trio ate and left no crumbs. π₯
β¨ SEE ALSO β¨
go read these next, they're all part of the family π
and that's the whole page, babe π it's straight out of the Library Functions Manual, signed off at the bottom with buffer_peek(3) like the main character it is. periodt. π
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms