> For the complete documentation index, see [llms.txt](https://man.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://man.bsdcn.org/sys/creat.2.md).

# creat(2)

`creat` — 创建新文件

## 名称

`creat`

## 库

Lb libc

## 概要

`#include <fcntl.h>`

```c
int
creat(const char *path, mode_t mode);
```

## 描述

此接口由 [open(2)](/sys/open.2.md) 取代。

`creat()` 函数等同于：

```c
open(path, O_CREAT | O_TRUNC | O_WRONLY, mode);
```

## 参见

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

## 历史

`creat()` 函数出现于 Version 1 AT\&T UNIX。
