gd_put_string(3)

NAME
gd_put_string — write a STRING or SARRAY element to a Dirfile database

SYNOPSIS
#include <getdata.h>

int gd_put_string(DIRFILE *dirfile, const char *field_code, const char *data_in);

DESCRIPTION
The function queries a dirfile(5) database specified by and stores the character string in the STRING or SARRAY scalar field, specified by If specifies a SARRAY field, the supplied string is stored as the first element. The argument must point to a valid DIRFILE object previously created by a call to Because string values are stored in the dirfile metadata, the new value of won't be written to disk until the dirfile metadata is flushed with or until the dirfile is closed with The function provides another way of storing STRING and SARRAY data to a Dirfile.

RETURN VALUE
On success, returns zero. On error, this a negative-valued error code. Possible error codes are: The specified was opened read-only. The field specified by was not found in the database. An invalid was supplied. The supplied referred to a field of type other than SARRAY or STRING. An internal error occurred in the library while trying to perform the task. This indicates a bug in the library. Please report the incident to the maintainer. The fragment containing the string was protected from change.

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 apepared in GetData-0.4.0. It returned a size_t cotnaining length of the string written, or zero on error. In GetData-0.7.0, this function was renamed to In GetData-0.10.0, this function's return value changed to zero on success, or or else a negative-valued error code.

SEE ALSO
dirfile(5),