Nios® V Processor Software Developer Handbook

ID 743810
Date 2/14/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

12.1.1.57. close()

Prototype

int close (int fd)

Commonly Called By

C/C++ programs

Device drivers

Thread-safe

See description.

Available from ISR

No.

Include

<unistd.h>

Description

The close() function is the standard UNIX-style close() function, which closes the file descriptor fd.

Calls to close() are thread-safe only if the implementation of close() provided by the driver that is manipulated is thread-safe.

Valid values for the fd parameter are: stdout, stdin, and stderr, or any value returned from a call to open().

Return

The return value is zero on success, and –1 otherwise. If an error occurs, errno is set to indicate the cause.