rreemmoovvee() -- General Function (libc)

Remove a file
#iinncclluuddee <ssttddiioo.hh>
iinntt
rreemmoovvee(_f_i_l_e_n_a_m_e)
ccoonnsstt cchhaarr *_f_i_l_e_n_a_m_e;

rreemmoovvee() breaks the link between  between _f_i_l_e_n_a_m_e and the actual file that
it represents.   In effect, it removes a file.   Thereafter, any attempt to
use _f_i_l_e_n_a_m_e to  open that file will fail.  It  is equivalent to the system
call uunnlliinnkk().

rreemmoovvee() will remove a file  that is currently open.  rreemmoovvee() returns zero
if it could remove _f_i_l_e_n_a_m_e, and nonzero if it could not.

_E_x_a_m_p_l_e
This example removes the file named on the command line.

#include <stdio.h>
#include <stdlib.h>

main(argc,argv)
int argc, char *argv[])
{
    if(argc != 1) {
        fprintf(stderr, "usage: remove filename\n");
        exit(EXIT_FAILURE);
    }

    if(remove(argv[1])) {
        perror("remove failed");
        exit(EXIT_FAILURE);
    }
    return(EXIT_SUCCESS);
}

_S_e_e _A_l_s_o
lliibbcc, uunnlliinnkk()
ANSI Standard, section 7.9.4.1
POSIX Standard, section 8.1
