1
2
3
4
5
6
7
8
9gd_put_string(3)                    GETDATA                   gd_put_string(3)
10
11
12

NAME

14       gd_put_string — write a STRING or SARRAY element to a Dirfile database
15
16

SYNOPSIS

18       #include <getdata.h>
19
20       int gd_put_string(DIRFILE *dirfile, const char *field_code, const char
21              *data_in);
22
23

DESCRIPTION

25       The gd_put_string() function queries a dirfile(5) database specified by
26       dirfile and stores the character string data_in in the STRING or SARRAY
27       scalar field, specified  by  field_code.   If  field_code  specifies  a
28       SARRAY field, the supplied string is stored as the first element.
29
30       The  dirfile  argument  must point to a valid DIRFILE object previously
31       created by a call to gd_open(3).
32
33       Because string values are stored in the dirfile metadata, the new value
34       of  field_code  won't  be written to disk until the dirfile metadata is
35       flushed with gd_metaflush(3), or  until  the  dirfile  is  closed  with
36       gd_close(3).
37
38       The  gd_put_sarray(3)  function  provides another way of storing STRING
39       and SARRAY data to a Dirfile.
40
41

RETURN VALUE

43       On success, gd_put_string() returns zero.  On error, this  a  negative-
44       valued error code.  Possible error codes are:
45
46       GD_E_ACCMODE
47               The specified dirfile was opened read-only.
48
49       GD_E_BAD_CODE
50               The  field  specified  by field_code was not found in the data‐
51               base.
52
53       GD_E_BAD_DIRFILE
54               An invalid dirfile was supplied.
55
56       GD_E_BAD_FIELD_TYPE
57               The supplied field_code referred to a field of type other  than
58               SARRAY or STRING.
59
60       GD_E_INTERNAL_ERROR
61               An  internal error occurred in the library while trying to per‐
62               form the task.  This indicates a bug in  the  library.   Please
63               report the incident to the maintainer.
64
65       GD_E_PROTECTED
66               The fragment containing the string was protected from change.
67
68       The  error  code  is  also  stored in the DIRFILE object and may be re‐
69       trieved after this function returns by calling gd_error(3).  A descrip‐
70       tive   error   string   for  the  error  may  be  obtained  by  calling
71       gd_error_string(3).
72
73

HISTORY

75       The put_string() function apepared in  GetData-0.4.0.   It  returned  a
76       size_t cotnaining length of the string written, or zero on error.
77
78       In GetData-0.7.0, this function was renamed to gd_put_strint().
79
80       In GetData-0.10.0, this function's return value changed to zero on suc‐
81       cess, or or else a negative-valued error code.
82
83

SEE ALSO

85       dirfile(5),      gd_close(3),      gd_get_string(3),       gd_error(3),
86       gd_error_string(3), gd_metaflush(3), gd_open(3), gd_put_sarray(3).
87
88
89
90Version 0.10.0                 25 December 2016               gd_put_string(3)
Impressum