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

# xdf\_seek(3)

move the sample pointer of a xDF file

## NAME

xdf\_seek - move the sample pointer of a xDF file

## SYNOPSIS

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

**off\_t xdf\_seek(struct xdf\*** *xdf***, off\_t** *offset***, int** *whence***);**\

## DESCRIPTION

**xdf\_seek**() repositions the current sample pointer according to the couple (*offset*,*whence*) where *whence* can be:

- **SEEK\_SET**

  The offset is set to *offset* bytes.

- **SEEK\_CUR**

  The offset is set to its current location plus *offset* bytes.

- **SEEK\_END**

  The offset is set to the size of the file plus *offset* bytes.

The file referenced by *xdf* should have been opened with mode **XDF\_READ** and **xdf\_prepare\_arrays**(3) should have been successfully called on it.

## RETURN VALUE

Upon successful completion, **xdf\_seek**() returns the resulting offset location as measured in number of samples from the beginning of the recording. Otherwise, a value of -1 is returned and *errno* is set to indicate the error.

## ERRORS

- **EINVAL**

  *xdf* is NULL or *whence* is none of the allowed values.

- **EPERM**

  No successfull call to [**xdf\_prepare\_transfer**(3)](/xdf_prepare_transfer/3.md) have been done on *xdf* or it has been opened using the mode **XDF\_WRITE**.

- **ERANGE**

  The requested offset is out of the range of the recording.

- **EINTR**

  The call was interrupted by a signal before any data was read; see [**signal**(7)](/signal/7.md).

- **EIO**

  A low-level I/O error occurred while reading from the inode.

- **ESTALE**

  Stale file handle. This error can occur for NFS and for other file systems

## SEE ALSO

[**xdf\_define\_arrays**(3)](/xdf_define_arrays/3.md), [**xdf\_prepare\_transfer**(3)](/xdf_prepare_transfer/3.md)
