DC_BUFFER_GET_DATA(3)

πŸ“¦ version 0.9.0, in nixos 26.05, nixpkgs unstable

πŸ’… DC_BUFFER_GET_DATA β€” bestie, let's get that data πŸ’…

okay so this is a page from the DC_BUFFER_GET_DATA(3) manual β€” it lives in section 3, the library functions section, and honestly? she's a lil one-function icon and we're gonna learn her together 🫢

✨ NAME ✨

dc_buffer_get_data β€” get the data of a buffer. that's it. that's the whole job. main character energy, zero notes πŸ’…

πŸ“š LIBRARY πŸ“š

she comes from the library libdivecomputer β€” say it with me now, that's the one, no cap ✨

🌸 SYNOPSIS 🌸

okay here's the part where you actually use her, so copy this exactly bestie, don't freestyle it:

#include <libdivecomputer/buffer.h>

unsigned char *
dc_buffer_get_data(dc_buffer_t *buffer);

like, include the header, call the function, receive an unsigned char *. she's giving straightforward and we love that for her πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

so what she does: she gets you the data used by buffer β€” and listen, that buffer has to have been previously allocated with dc_buffer_new(3). no sneaky uninitialized buffers, okay? that's not the vibe πŸ™ˆ

and if what you actually want is the size of the buffer? that's a whole different girl, you want dc_buffer_get_size(3) for that ✨

πŸ’€ big important warning, fr fr: the returned pointer is not valid after subsequent calls that change the buffer. like, she's a temporary queen. use her, then let her go. do not hold onto that pointer and act surprised later. that's on you bestie 😭

πŸ”₯ RETURN VALUES πŸ”₯

she returns the data πŸ’–βœ¨ and she'll return NULL in exactly two situations, memorize these:

  • buffer is NULL (happens to the best of us, no judgement 🫢)
  • no data has been allocated to the buffer (empty era, we've all been there)

πŸ‘‘ SEE ALSO πŸ‘‘

🌈 AUTHORS 🌈

the library libdivecomputer library was written by Jef Driesen, jef@libdivecomputer.org β€” an absolute legend 🧚

and the manpages were written by Kristaps Dzonsons, kristaps@bsd.lv β€” also iconic, we stan both πŸ‘‘


okay that's the whole page, you ate that πŸ’…πŸ’– this little beauty is from Debian, dated January 5, 2017, and that's the DC_BUFFER_GET_DATA(3) manual β€” go forth and get your data, bestie, iykyk πŸ¦‹πŸŒΈβ­

πŸ“¦ where this page comes from