muroar_read(3)

πŸ“¦ version 0.1.13, in ubuntu jammy

πŸ’– muroar_read β€” bestie edition πŸ’–

okay so real quick, we're in the muRoar Programmer's Manual: IO Extension today, and the star of the show is muroar_read(3). pull up a chair, grab a boba, we're reading bytes πŸ§‹βœ¨


🌸 NAME 🌸

muroar_read β€” read data from a stream in a portable way πŸ¦‹

like, no cap, portable. it does not care what OS you're on. it just reads. main character energy fr.


✨ SYNOPSIS ✨

#include <muroar.h>

ssize_t muroar_read   (muroar_t fh,  void * buf, size_t len);

πŸŽ€ DESCRIPTION πŸŽ€

so this function reads data from a stream that's connected to a sound server. that's the whole vibe. πŸ’…

the reason it exists (and bestie, this is the important part) is that it gives you a portable way to read data from the sound server β€” one that does not depend on the underlying operating system. you don't gotta think about what's underneath. it just works. slay. πŸ”₯


🫢 PARAMETERS 🫢

  • fh β€” the stream file handle that's connected to the server. it must have been opened using muroar_stream(3). no shortcuts, no vibes-only handles, it has to come from there. πŸ™ˆ
  • buf β€” a pointer to the block of data that should be read. this is where the bytes land, bestie. πŸ“
  • len β€” the total length, in bytes, of the data that should be read. count it in bytes, not in feelings. πŸ’œ

⭐ RETURN VALUE ⭐

  • on success: this call returns the number of bytes successfully read. (yes, it tells you how many. very considerate of it. πŸ‘‘)
  • on error: -1 is returned. 😭

🌈 NOTES 🌈

under the hood, this function calls the underlying read function in a loop. icon behaviour honestly.

⚠️ heads up: if it returns less than the given length, do not re-try directly. instead, wait at least some milliseconds first. seriously. give the server a lil breather. it's giving patience is a virtue, periodt. πŸ’€

πŸ¦‹ HISTORY πŸ¦‹

this function first appeared in muRoar version 0.1beta0. a true og. nostalgic era fr fr. ✨


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie πŸ’– this came out of the muRoar crew back in April 2012, so like… vintage. still hits. go read some bytes, you got this. πŸŽ€πŸŒΈπŸ’…

πŸ“¦ where this page comes from