gd_put_carray_slice(3)

NAME
gd_put_carray, gd_put_carray_slice, gd_put_constant — write CONST or CARRAY data to a dirfile database

SYNOPSIS
#include <getdata.h>

int gd_put_carray_slice(DIRFILE *dirfile, const char *field_code, unsigned int start, size_t len, gd_type_t data_type, const void *data_in);

int gd_put_carray(DIRFILE *dirfile, const char *field_code, gd_type_t data_type, const void *data_in);

int gd_put_constant(DIRFILE *dirfile, const char *field_code, gd_type_t data_type, const void *data_in);

DESCRIPTION
The function writes data to a dirfile(5) database specified by into the CARRAY scalar array The data in the field is converted from the data type specified by and read from in the user-supplied buffer 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

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 function is equivalent to calling with equal to zero and equal to one. None of these interfaces can write to field representations.

The argument must point to a valid memory location containing all the data to be written. 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 CARRAY, first increase its length by calling or another equivalent function.

The argument should be one of the following symbols, which indicates the type of the data pointed to by

    GD_UINT8
        unsigned 8-bit integer signed (two's complement) 8-bit integer unsigned 16-bit integer signed (two's complement) 16-bit integer unsigned 32-bit integer signed (two's complement) 32-bit integer unsigned 64-bit integer signed (two's complement) 64-bit integer IEEE-754 standard 32-bit single precision floating point number IEEE-754 standard 64-bit double precision floating point number C99-conformant 64-bit single precision complex number C99-conformant 128-bit double precision complex number

The type of the input data need not be the same as the storage type of the field. Type conversion will be performed as necessary to return the requested type. The argument must point to a valid DIRFILE object previously created by a call to

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. The supplied was invalid. The supplied was not a CONST nor a CARRAY. An invalid was specified. 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 function appeared in GetData-0.4.0.

In GetData-0.7.0, this function was renamed to The functions and functions also appeared in this release.

In GetData-0.10.0, the error return from this function changed from -1 to a negative-valued error code.

SEE ALSO
dirfile(5),