---
name: "open_trunc"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/open_trunc"
---

# open\_trunc(3)

open a file for writing

## NAME

open\_trunc - open a file for writing

## SYNTAX

**#include \<libowfat/open.h\>**

int **open\_trunc**(const char \**filename*);

## DESCRIPTION

open\_trunc opens the file *filename* for write-only use and returns the file handle.  If the file exists, it will be truncated to zero bytes length.  If it does not exist, it will be created with mode 0644.  If there was an error opening or creating the file, open\_trunc returns -1 and sets errno accordingly.

## SEE ALSO

[open(2)](/open/2.md)
