Scroll to navigation

gd_spf(3) GETDATA gd_spf(3)


gd_spf — returns the samples per frame for a field in a dirfile


#include <getdata.h>

unsigned int gd_spf(DIRFILE *dirfile, const char *field_code);


The gd_spf() function queries a dirfile(5) database specified by dirfile and determines the number of samples per frame for the field field_code. This information is also available from gd_entry(3).

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


Upon successful completion, gd_spf() returns a positive integer indicating the number of samples per frame for the field specified. On error, it 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 field specified by field_code was not found in the database.
The supplied dirfile was invalid.
A scalar field was found where a vector field was expected.
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.
Too many levels of recursion were encountered while trying to resolve field_code. This usually indicates a circular dependency in field specification in the dirfile.

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


The get_spf() function appeared in GetData-0.3.0.

In GetData-0.7.0, this function was renamed to gd_spf().

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


gd_entry(3), gd_error(3), gd_error_string(3), gd_open(3), dirfile(5)

25 December 2016 Version 0.10.0