---
name: "gd_nmvectors"
section: "3"
platform: "linux"
package: "libgetdata-dev"
version: "0.7.3-6+b2"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/gd_nmvectors"
---

# gd\_nmvectors(3)

report the number of vector fields in a dirfile

## NAME

gd\_nmvectors — report the number of vector fields in a dirfile

## SYNOPSIS

**#include \<getdata.h\>**

**unsigned int gd\_nmvectors(DIRFILE \****dirfile***);**

## DESCRIPTION

The **gd\_nmvectors**() function queries a [dirfile(5)](/dirfile/5.md) database specified by *dirfile* and returns the number of vector metafields defined in the database (*i.e.* fields of types **BIT**, **LINCOM**, **LINTERP**, **MULTIPLY**, **PHASE**, and **RAW**)**for** the supplied parent field.

The  *dirfile* argument must point to a valid DIRFILE object previously created by a call to [**gd\_open**(3)](/gd_open/3.md).

## RETURN VALUE

Upon successful completion, **gd\_nmvectors**() returns the number of vector metafields in the dirfile for the given parent.  On error, it returns zero and sets the dirfile error to a non-zero error value. Possible error values are:

- **GD\_E\_BAD\_CODE**

  The supplied parent field code was not found, or referred to a metafield itself.

- **GD\_E\_BAD\_DIRFILE**

  The supplied dirfile was invalid.

The dirfile error may be retrieved by calling [**gd\_error**(3)](/gd_error/3.md). A descriptive error string for the last error encountered can be obtained from a call to [**gd\_error\_string**(3)](/gd_error_string/3.md).

## SEE ALSO

[**dirfile**(5)](/dirfile/5.md), [**gd\_open**(3)](/gd_open/3.md), [**gd\_error**(3)](/gd_error/3.md), [**gd\_error\_string**(3)](/gd_error_string/3.md), [**gd\_mvector\_list**(3)](/gd_mvector_list/3.md), [**gd\_nmfields**(3)](/gd_nmfields/3.md), [**gd\_nvectors**(3)](/gd_nvectors/3.md)
