gd_put_sarray_slice(3)

NAME
gd_put_sarray, gd_put_sarray_slice — write STRING or SARRAY data to a Dirfile database

SYNOPSIS
#include <getdata.h>

int gd_put_sarray_slice(DIRFILE *dirfile, const char *field_code, unsigned int start, size_t len, const char **data_in);

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

DESCRIPTION
The function writes string data to a dirfile(5) database specified by into the STRING or SARRAY scalar array The location of the first element of the field into which data is stored is given by and the number of elements stored is given by

If specifies a STRING field, it is treated as if it were a SARRAY field of length one.

The function behaves similarly, except the whole scalar array is written, as if were called with equal zero and equal to the value returned by

The argument must point to an array of pointers to character strings, which are the values to store. The number of elements which will be stored by may be obtained by calling Unlike writing data past the end of the field is not permitted. To add data to a SARRAY, first increase its length by calling or another equivalent function.

The function provides another way of writing data to a STRING field.

RETURN VALUE
On success, and return zero. On error, they return a negative-valued error code. Possible error codes are: The specified was opened read-only. The library was unable to allocate memory. The field specified by was not found in the database. An invalid was supplied. The supplied was not a STRING nor a SARRAY. A request for data beyond the end of the field was made. 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 constant 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 and functions appeared in GetData-0.10.0.

SEE ALSO
dirfile(5),