Scroll to navigation

gd_nframes(3) GETDATA gd_nframes(3)


gd_nframes — report the size of a Dirfile


#include <getdata.h>

off_t gd_nframes(DIRFILE *dirfile);


The gd_nframes() function queries a dirfile(5) database specified by dirfile and returns the number of frames in the database. Since different fields may have differing number of frames, the Dirfile Standards (see dirfile(5)) dictate that the number of frames in the database is defined to be equal to the number of frames in the reference field defined by the /REFERENCE directive (see dirfile-format(5)) or, if no such reference field is defined, by the first raw field specified in the format specification.

If no vector fields are defined in the database, gd_nframes() returns zero and succeeds.

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


Upon successful completion, gd_nframes() returns the number of frames in the dirfile, which is never negative. On error, it returns a negative-valued error code. Possible error codes are:

The library was unable to allocate memory.
The supplied dirfile was invalid.
An I/O error occurred while determining the number of samples in the data file associated with the reference field.
The number of samples available for the reference field could not be determined because the encoding used to store the reference field's data file was not understood.
GetData does not support determining the number of samples for the encoding of of the data file associated with the reference field.

The error code is also stored in the DIRFILE object and may be retrieved after this function returns by calling gd_error(3). A descriptive error string for the error may be obtained by calling gd_error_string(3).


The get_nframes() function appeared in GetData-0.3.0.

In GeData-0.7.0, this function was renamed to gd_nframes().


dirfile(5), dirfile-encoding(5), gd_open(3), gd_bof(3), gd_eof(3), gd_error(3), gd_error_string(3)

25 December 2016 Version 0.10.0