gd_array_len3
Returns the length of a carray or sarray field in a dirfile
Usage
#include <getdata.h>
size_t gd_array_len(DIRFILE *dirfile, const char *field_code);
Overview
The gd_array_len() function queries a dirfile(5) database specified by dirfile and calculates the length of the CARRAY, CONST, STRING, or SARRAY field called field_code. If field_code contains a valid representation suffix, it will be ignored.
The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3).
Return value
Upon successful completion, gd_array_len() returns a positive integer indicating the array length of the field specified. (The length of a CONST or a STRING field is always 1.) On error, it returns a negative-valued error code. Possible error codes are:
.TP 8 GD_E_BAD_CODE The field specified by field_code was not found in the database.
.TP 8 GD_E_BAD_DIRFILE The supplied dirfile was invalid.
.TP 8 GD_E_BAD_FIELD_TYPE The field specified by field_code was not of one of the field types listed above.
The error code is also stored in the DIRFILE object and may be retrieved after this function returns by calling gd_error(3). A descriptive error string for the error may be obtained by calling gd_error_string(3).
Releases
5 releases since Debian 9 (Stretch); the text changed 1 time.