get_nframes (3) - Linux Manuals

get_nframes: report the size of a dirfile


get_nframes --- report the size of a dirfile


#include <getdata.h>
off_t get_nframes(DIRFILE *dirfile);


The get_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 first raw field specified in the format file.

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

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


Upon successful completion, get_nframes() returns the number of frames in the dirfile. On error, it returns zero and sets the dirfile error to a non-zero error value. Possible error values are:
The supplied dirfile was invalid.
An attempt to stat(2) the file associated with first raw field defined in the format failed.
Reading from dirfiles with the encoding scheme of the specified dirfile is not supported by the library. See dirfile-encoding(5) for details on dirfile encoding schemes. The dirfile error may be retrieved by calling get_error(3). A descriptive error string for the last error encountered can be obtained from a call to get_error_string(3).