---
name: "mongoc_gridfs_file_seek"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_gridfs_file_seek"
---

# mongoc\_gridfs\_file\_seek(3)

## SYNOPSIS

```
int
mongoc_gridfs_file_seek (mongoc_gridfs_file_t *file, int64_t delta, int whence);
```

## PARAMETERS

- •

  **file**: A *mongoc\_gridfs\_file\_t*.

- •

  **delta**: The amount to move the file position. May be positive or negative.

- •

  **whence**: One of SEEK\_SET, SEEK\_CUR or SEEK\_END.

## DESCRIPTION

Adjust the file position pointer in the given file by **delta**, starting from the position **whence**. The **whence** argument is interpreted as in **fseek(2)**:

| | |
| --- | --- |
| **SEEK\_SET** | Set the position relative to the start of the file. |
| **SEEK\_CUR** | Move **delta** relative to the current file position. |
| **SEEK\_END** | Move **delta** relative to the end of the file. |

On success, the file's underlying position pointer is set appropriately. On failure, the file position is NOT changed and errno is set to indicate the error.

## ERRORS

| | |
| --- | --- |
| **EINVAL** | **whence** is not one of SEEK\_SET, SEEK\_CUR or SEEK\_END. |
| **EINVAL** | The resulting file position would be negative. |

## RETURNS

Returns 0 if successful; otherwise -1 and errno is set.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
