1
2
3
4
5
6
7
8
9gd_array_len(3) GETDATA gd_array_len(3)
10
11
12
14 gd_array_len — returns the length of a CARRAY or SARRAY field in a
15 Dirfile
16
17
19 #include <getdata.h>
20
21 size_t gd_array_len(DIRFILE *dirfile, const char *field_code);
22
23
25 The gd_array_len() function queries a dirfile(5) database specified by
26 dirfile and calculates the length of the CARRAY, CONST, STRING, or
27 SARRAY field called field_code. If field_code contains a valid repre‐
28 sentation suffix, it will be ignored.
29
30 The dirfile argument must point to a valid DIRFILE object previously
31 created by a call to gd_open(3).
32
33
35 Upon successful completion, gd_array_len() returns a positive integer
36 indicating the array length of the field specified. (The length of a
37 CONST or a STRING field is always 1.) On error, it returns a negative-
38 valued error code. Possible error codes are:
39
40 GD_E_BAD_CODE
41 The field specified by field_code was not found in the data‐
42 base.
43
44 GD_E_BAD_DIRFILE
45 The supplied dirfile was invalid.
46
47 GD_E_BAD_FIELD_TYPE
48 The field specified by field_code was not of one of the field
49 types listed above.
50
51 The error code is also stored in the DIRFILE object and may be re‐
52 trieved after this function returns by calling gd_error(3). A descrip‐
53 tive error string for the error may be obtained by calling
54 gd_error_string(3).
55
56
58 The gd_carray_len() function appeared in GetData-0.7.0. It was re‐
59 stricted to CONST and CARRAY entries.
60
61 In GetData-0.9.0, this function was renamed to gd_array_len, and STRING
62 entries were now valid for this function.
63
64 Before GetData-0.10.0, this function could also fail with the error
65 code GD_E_ALLOC.
66
67 In GetData-0.10.0, the error return from this function changed from -1
68 to a negative-valued error code.
69
70
72 dirfile(5), gd_open(3), gd_error(3), gd_error_string(3)
73
74
75
76Version 0.10.0 25 December 2016 gd_array_len(3)