---
name: "gfs_pio_recvfile"
section: "3"
platform: "linux"
package: "libgfarm-dev"
version: "2.7.20+dfsg-1.2+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/gfs_pio_recvfile"
---

# gfs\_pio\_recvfile(3)

receive a Gfarm file to local machine

## NAME

gfs\_pio\_recvfile - receive a Gfarm file to local machine

## SYNOPSIS

```
#include <gfarm/gfarm.h>
```

**gfarm\_error\_t gfs\_pio\_recvfile(GFS\_File** *r\_gf***, gfarm\_off\_t** *r\_off***, int** *w\_fd***, gfarm\_off\_t** *w\_off***, gfarm\_off\_t** *len***, gfarm\_off\_t \*** *recvp***);**

## DESCRIPTION

Receives *len* bytes of data from the position specified by the offset *r\_off* in a Gfarm file *r\_gf*, to the position specified by the offset *w\_off* of a local file which is pointed by a file descriptor *w\_fd*. If len is -1, this function transfers until the end of the file. The transfered bytes will be stored to the memory pointed by *recvp* when *recvp* is not **NULL**. If *len* is a positive value, and the value pointed by *recvp* is less than *len*, that means the transfer reached EOF.

## RETURN VALUES

**GFARM\_ERR\_NO\_ERROR**

The function terminated successfully.

**GFARM\_ERR\_OPERATION\_NOT\_PERMITTED**

*gf* does not specify a regular file.

**GFARM\_ERR\_BAD\_FILE\_DESCRIPTOR**

The file descripter specified by *gf* is not a valid or is not open for reading.

**GFARM\_ERR\_NO\_FILE\_SYSTEM\_NODE**

There is no available file system node.

**GFARM\_ERR\_NO\_MEMORY**

Insufficient memory was available.

Others

An error except the above occurred. The reason is shown by **gfarm\_error\_string**(3).

## SEE ALSO

[**gfs\_pio\_create**(3)](/gfs_pio_create/3.md), [**gfs\_pio\_open**(3)](/gfs_pio_open/3.md), [**gfs\_pio\_read**(3)](/gfs_pio_read/3.md), [**gfs\_pio\_sendfile**(3)](/gfs_pio_sendfile/3.md)
