XDF_ADD_CHANNEL(3)

πŸ’– XDF_ADD_CHANNEL πŸ’–

okay bestie, welcome to the xdffileio library manual ✨ this one's about xdf_add_channel, and fr fr it's the glow-up your XDF file's been waiting for πŸŽ€


✨ NAME ✨

xdf_add_channel β€” appends a channel to a XDF file πŸ¦‹


🌸 SYNOPSIS 🌸

#include <xdfio.h>

struct xdfch* xdf_add_channel(struct xdf* xdf, const char* label);

πŸ’… DESCRIPTION πŸ’…

so basically, xdf_add_channel() appends a channel to the file that the handle xdf is pointing at. the new channel gets initialized with the label argument (but only if it's not NULL, okurrr πŸ‘€) and with the default channel values that are set in the XDF file β€” meaning the ones you set using the channel configuration fields in xdf_set_conf(3) (go read that related manpage, it's giving required reading πŸ“–).

if the call to xdf_add_channel(3) succeeds, the default offset value β€” that's the field referenced by XDF_CF_ARROFFSET β€” gets incremented by the size of the current default stored type, which is the field referenced by XDF_CF_STOTYPE. so as a consequence, if the channel default values haven't changed in-between, then the next call to xdf_add_channel() will create a channel whose location in the array is gonna be right next to the previous one. lineup? immaculate. πŸ”₯

this type of initialization lets you add channels without having to specifically pack them β€” that's just achieved by default. no extra work, no stress, main character energy only πŸ‘‘


🫢 RETURN VALUE 🫢

xdf_add_channel() returns the handle to the newly created channel descriptor if everything slays. otherwise it returns NULL and errno gets set appropriately. so like, check your errno bestie, she's trying to tell you something 😭


πŸ’€ ERRORS πŸ’€

  • EINVAL β€” xdf is NULL. girl. it's null.
  • ENOMEM β€” the system is unable to allocate resources. the memory said no πŸ™ˆ
  • EPERM β€” the file referenced by xdf has been opened with the mode XDF_READ. you can't add to something opened read-only, that's not the vibe 🌸

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, periodt πŸ’œ this lil manual is from the xdffileio library manual, and it's brought to you by EPFL, dated 2010 β€” yes she's been iconic since 2010, we love a legacy queen 🌈 mwah, go add some channels bestie πŸŽ€βœ¨