gd_endianness—report the byte sex of fields in a Dirfile


#include <getdata.h>

unsigned long gd_endianness(DIRFILE *dirfile, int fragment_index);


The gd_endianness() function queries a dirfile(5) database specified by dirfile and retrieves the byte sex of the fragment indexed by fragment_index. The byte sex of a fragment indicates the endianness of data files associated with RAW fields defined in the specified fragment. The endianness of a fragment containing no RAW fields is not meaningful.

The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3).


Upon successful completion, gd_endianness() returns the byte sex of the specified fragment, which will be either GD_BIG_ENDIAN or GD_LITTLE_ENDIAN. This will be bitwise-or'd with either GD_ARM_ENDIAN or GD_NOT_ARM_ENDIAN, indicating whether double-precision floating point data in this fragment are stored in the old ARM middle-endian format.

On error, this function returns zero and stores a negative-valued error code in the DIRFILE object which may be retrieved by a subsequent call to gd_error(3). Possible error codes are:

The supplied dirfile was invalid.
The supplied index was out of range.

A descriptive error string for the error may be obtained by calling gd_error_string(3).


The get_endianness() function appeared in GetData-0.5.0.

In GetData-0.7.0, this function was renamed to gd_endianness(). This version also added the GD_ARM_ENDIAN and GD_NOT_ARM_ENDIAN flags.


gd_alter_endianness(3), gd_getdata(3), gd_error(3), gd_error_string(3), gd_open(3), dirfile(5), dirfile-format(5)

Last updated on 25 December 2016 for GetData Version 0.10.0.