cclloossee() -- System Call (libc)

Close a file
#iinncclluuddee <uunniissttdd.hh>
iinntt cclloossee(_f_d) iinntt _f_d;

cclloossee() closes  the file  identified by the  file descriptor _f_d,  which was
returned  by ccrreeaatt(),  dduupp(), ooppeenn(),  or ppiippee().   cclloossee() also  frees the
associated file descriptor.

Because each  program can have only  a limited number of  files open at any
given time, programs that  process many files should cclloossee() files whenever
possible.  The  function eexxiitt() automatically  calls ffcclloossee() for  all open
files; however, the system call _eexxiitt() does not.

_E_x_a_m_p_l_e
For an example of this function, see the entry for ooppeenn().

_S_e_e _A_l_s_o
ccrreeaatt(), lliibbcc, ooppeenn(), uunniissttdd.hh
ANSI Standard, section 4.9.3
POSIX Standard, section 6.3.1

_D_i_a_g_n_o_s_t_i_c_s
cclloossee() returns -1 if an error  occurs, such as its being handed a bad file
descriptor; otherwise, it returns zero.
