---
name: "xdf_define_arrays"
section: "3"
platform: "linux"
package: "libxdffileio-dev"
version: "0.3-4+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/xdf_define_arrays"
---

# xdf\_define\_arrays(3)

Specify the number of input/output arrays

## NAME

xdf\_define\_arrays - Specify the number of input/output arrays

## SYNOPSIS

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

**int xdf\_define\_arrays(struct xdf\*** *xdf***,**\
                       **unsigned int** *narrays***, const size\_t \****strides***);**\

## DESCRIPTION

**xdf\_define\_arrays**() specifies the number of arrays and its strides for upcoming calls to [**xdf\_write**(3)](/xdf_write/3.md) and [**xdf\_read**(3)](/xdf_read/3.md) using *xdf*. This function is used to configure the upcoming transfer. As such, it must be called before [**xdf\_prepare\_transfer**(3)](/xdf_prepare_transfer/3.md) (calling it after will produce an error). However the function may be called several times but only the last call is meaningful for the transfer.

*narrays* specifies the number of arrays that will be provided in the argument list of [**xdf\_write**(3)](/xdf_write/3.md) or [**xdf\_read**(3)](/xdf_read/3.md).

*strides* argument should point to an array of *narrays* unsigned int corresponding respectively to the stride of each arrays that will be supplied to the upcoming call to [**xdf\_write**(3)](/xdf_write/3.md) or [**xdf\_read**(3)](/xdf_read/3.md). The stride corresponds to the length in byte between two consecutive samples of the same channel in the array.

## RETURN VALUE

**xdf\_define\_arrays**() returns 0 in case of success, otherwise -1 and *errno* is set appropriately.

## ERRORS

- **ENOMEM**

  The system is unable to allocate resources.

## SEE ALSO

[**xdf\_prepare\_transfer**(3)](/xdf_prepare_transfer/3.md), [**xdf\_read**(3)](/xdf_read/3.md), [**xdf\_write**(3)](/xdf_write/3.md)
