---
name: "fd_move"
section: "3"
platform: "linux"
package: "qmail"
version: "1.06-6.2~deb10u1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/fd_move"
---

# fd\_move(3)

renumber a descriptor

## NAME

fd\_move - renumber a descriptor

## SYNTAX

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

int **fd\_move**(*to*,*from*);

int *to*;\
 int *from*;

## DESCRIPTION

**fd\_move** moves descriptor *from* to descriptor *to*. If *to* was already open, **fd\_move** closes it. If the move is successful, **fd\_move** closes *from*. Exception: if *to* and *from* are the same number, **fd\_move** does nothing.

**fd\_move** returns 0 on success, -1 on error.

## SEE ALSO

[dup(2)](/dup/2.md), [fd\_copy(3)](/fd_copy/3.md)
