1put_string(3) GETDATA put_string(3)
2
3
4
6 put_string — retrieve a string from a dirfile database
7
9 #include <getdata.h>
10
11 int put_string(DIRFILE *dirfile, const char *field_code, const char
12 *data_in);
13
15 The put_string() function queries a dirfile(5) database specified by
16 dirfile and sets the STRING field_code , which should not contain a
17 representation suffix, to the value specified in data_in.
18
19 The dirfile argument must point to a valid DIRFILE object previously
20 created by a call to dirfile_open(3).
21
22 Because string values are stored in the dirfile metadata, the new value
23 of field_code won't be written to disk until the dirfile metadata is
24 flushed with dirfile_metaflush(3), or until the dirfile is closed.
25
27 On success, put_string() returns the length of the string stored, in‐
28 cluding the trailing NUL character. On error, it returns 0 and sets
29 the dirfile error to a non-zero value. Possible error values are:
30
31 GD_E_BAD_CODE
32 The field specified by field_code was not found in the data‐
33 base.
34
35 GD_E_BAD_DIRFILE
36 An invalid dirfile was supplied.
37
38 GD_E_BAD_FIELD_TYPE
39 The supplied field_code referred to a field of type other than
40 STRING. The caller should use putdata(3), or put_constant(3)
41 instead.
42
43 GD_E_BAD_REPR
44 The representation suffix specified in field_code was not
45 recognised.
46
47 GD_E_BAD_TYPE
48 An invalid data_type was specified.
49
50 GD_E_INTERNAL_ERROR
51 An internal error occurred in the library while trying to per‐
52 form the task. This indicates a bug in the library. Please
53 report the incident to the maintainer.
54
55 GD_E_PROTECTED
56 The fragment containing the string was protected from change.
57
58 The dirfile error may be retrieved by calling get_error(3). A descrip‐
59 tive error string for the last error encountered may be obtained from a
60 call to get_error_string(3).
61
63 dirfile(5), dirfile_metaflush(3), dirfile_open(3), getdata(3),
64 get_string(3), get_error(3), get_error_string(3), putdata(3)
65
66
67
68Version 0.6.1 9 February 2010 put_string(3)