gd_array_len(3)

✨ gd_array_len ✨

okay bestie, welcome to the GETDATA section 3 manual page for gd_array_len πŸ’… like, this is the one that tells you how long your array actually IS. no cap.


🌸 NAME 🌸

gd_array_len β€” returns the length of a CARRAY or SARRAY field in a Dirfile πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <getdata.h>

size_t gd_array_len(DIRFILE *dirfile, const char *field_code);

πŸ’– DESCRIPTION πŸ’–

so the gd_array_len() function goes and queries a dirfile(5) database β€” that's the one you pass in as dirfile β€” and it calculates the length of the CARRAY, CONST, STRING, or SARRAY field called field_code. that's it, that's the job. 🫢

and listen: if field_code contains a valid representation suffix, it gets ignored. literally just ignored. it's giving "not relevant to my journey." πŸ’€

the dirfile argument must point to a valid DIRFILE object that was previously created by a call to gd_open(3). no random unopened dirfiles, bestie, that's not the vibe. ✨


πŸ‘‘ RETURN VALUE πŸ‘‘

upon successful completion (slay), gd_array_len() returns a positive integer indicating the array length of the field you specified. and btw, the length of a CONST or a STRING field is always 1 β€” that's just the lore. ⭐

on error? it returns a negative-valued error code. 😭 possible error codes are:

  • GD_E_BAD_CODE β€” the field specified by field_code was not found in the database. bestie where is it. πŸ™ˆ
  • GD_E_BAD_DIRFILE β€” the supplied dirfile was invalid. πŸ’€
  • GD_E_BAD_FIELD_TYPE β€” the field specified by field_code was not of one of the field types listed above. wrong genre of field, unfortunately. πŸŽ€
the error code is also stored in the DIRFILE object, and you can retrieve it after this function returns by calling gd_error(3). and if you want a descriptive error string for the error, that's gd_error_string(3). use your resources, bestie. πŸ’…

🌈 HISTORY 🌈

  • the gd_carray_len() function appeared in GetData-0.7.0. it was restricted to CONST and CARRAY entries.
  • in GetData-0.9.0, this function was renamed to gd_array_len, and STRING entries were now valid for this function. glow up fr fr ✨
  • before GetData-0.10.0, this function could also fail with the error code GD_E_ALLOC.
  • in GetData-0.10.0, the error return from this function changed from -1 to a negative-valued error code. character development. πŸ¦‹

πŸŽ€ SEE ALSO πŸŽ€

dirfile(5), gd_open(3), gd_error(3), gd_error_string(3)


okay that's the whole page, you ate that πŸ“πŸ’œ

this was Version 0.10.0, dated 25 December 2016 β€” yes it's an old queen and she's still iconic, periodt. πŸ‘‘πŸŒˆπŸ’