# close Function

Closes the file associated with the file descriptor.

Attention: This interface function is implemented only by MPLAB XC32 C compilers.

Include

<unistd.h>

Prototype

int close(int handle);

Argument

 handle handle (file descriptor) referring to an opened file

Return Value

Returns 0 if the file is successfully closed or -1 on an error.

Remarks

This function is implemented as a stub that must be completed to suite the application.

This helper function is called by the fclose() Standard C Library function.

This function should be implemented to close a file in a manner that is relevant to your application. A file need not necessarily be associated with a storage device. This function should return -1 to signal an error and a strict implementation will set errno to some appropriate value such as EBADF or EIO.

Default Behavior

As distributed, this function passes the file handle to the simulator, which issues a close in the host file system.

Source File

close.c