gd_array_len(3)

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
The function queries a dirfile(5) database specified by and calculates the length of the CARRAY, CONST, STRING, or SARRAY field called If contains a valid representation suffix, it will be ignored.

The argument must point to a valid DIRFILE object previously created by a call to

RETURN VALUE
Upon successful completion, 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: The field specified by was not found in the database. The supplied dirfile was invalid. The field specified by 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 A descriptive error string for the error may be obtained by calling

HISTORY
The 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.

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.

SEE ALSO
dirfile(5),