buffer_peekc(3)

✨ NAME ✨

buffer_peekc β€” read one char from buffer πŸ‘€


πŸŽ€ SYNTAX πŸŽ€

okay so first you gotta pull in the header, bestie:

#include <libowfat/buffer.h>

int buffer_peekc(buffer* b,char* x);

πŸ’… DESCRIPTION πŸ’…

So buffer_peekc(b,x) is literally the same vibe as buffer_get(b,x,1), except β€” and this is the whole point, the moment, the main character energy β€” it does not advance the buffer pointer. 🫢

Which means if you call it again, or you call buffer_getc right after it, you get the exact same data again. It's giving "look but don't touch". It's giving window shopping. No cap. πŸ¦‹

peek responsibly bestie, the pointer is staying exactly where it is 🌸

πŸ”₯ RETURN VALUE πŸ”₯

  • 1 β€” slay, success, you got your char πŸ’–
  • 0 β€” you've hit the end of the file, that's a wrap πŸ₯²
  • -1 β€” there was an I/O error, and it sets errno appropriately so you can go find out what went wrong πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the tea, bestie πŸ“ this lil icon lives in the Library Functions Manual, filed under buffer_peekc(3) β€” go peek at your buffers, but like, respectfully πŸ’œπŸ§š