Next Previous Contents

## 3.117 open

> Function

>   Open and possibly create a file.

> Header

>   `fcntl.h`

> Declaration

>   `int open (const char* name, int flags, ...);`

> Description

>   `open` opens a file and returns the file descriptor associated with it. On error, -1 is returned and an error code is stored in `errno`. Several flags may be passed to `open` that change the behaviour.

> Limits

>   - POSIX specifies an additional `mode` argument that may be passed to open, which is used as the permission mask when a new file is created. While cc65 allows to pass this argument, it is ignored.
> Availability

>   POSIX 1003.1

> See also

>   close, creat

> Example

>   None.

Next Previous Contents