gd_get_carray_slice(3)

NAME
gd_get_carray, gd_get_carray_slice, gd_get_constant — retrieve CONST or CARRAY data from a Dirfile database

SYNOPSIS
#include <getdata.h>

int gd_get_carray_slice(DIRFILE *dirfile, const char *field_code, unsigned int start, size_t len, gd_type_t return_type, void *data_out);

int gd_get_carray(DIRFILE *dirfile, const char *field_code, gd_type_t return_type, void *data_out);

int gd_get_constant(DIRFILE *dirfile, const char *field_code, gd_type_t return_type, void *data_out);

DESCRIPTION
The function queries a dirfile(5) database specified by for the CONST or CARRAY scalar which may contain a representation suffix. The data in the field is converted to the data type specified by and stored in the user-supplied buffer The first element of the field stored is given by and the number of elements stored is given by The function behaves similarly, except it returns the entire field, as if were called with equal to zero and equal to the value returned by The function is equivalent to calling with equal to zero and equal to one. The argument must point to a valid DIRFILE object previously created by a call to The argument must point to a valid memory location of sufficient size to hold all the requested data of the return type specified. The number of elements returned by may be obtained by calling Unlike calling never results in a short read; attempting to read past the end of the field will result in an error, and no data will be returned. The argument should be one of the following symbols, which indicates the desired return type of the data:
    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 null type: the database is queried as usual, but no data is returned. In this case, is ignored and may be NULL.
The return type of the field need not be the same as the type of the data stored in the database. Type conversion will be performed as necessary to return the requested type. If the does not indicate a representation, but conversion from a complex value to a purely real one is required, only the real portion of the requested vector will be returned.

RETURN VALUE
On success, and return zero. On error, they return a negative-valued error code. Possible error codes are: 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 CONST nor 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 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 In this release, the and functions also appeared. In GetData-0.10.0, the error return from these functions changed from -1 to a negative-valued error code.

SEE ALSO
dirfile(5)