Use C remove function to delete a file

Syntax

C remove function has the following syntax.

int remove(const char *fname);

C remove function is from header file stdio.h.

Description

C remove function deletes file by *fname.

C remove function returns zero on success or nonzero on error.

Example

Use C remove function to delete a file.


#include <stdio.h>
/*from   w w w  .  ja  v a  2 s . c o  m*/
int main(int argc, char *argv[])
{
  if(remove("test"))
         printf("Remove Error");

  return 0;
}




















Home »
  C Language »
    Function Reference »




assert.h
ctype.h
math.h
setjmp.h
signal.h
stdio.h
stdlib.h
string.h
time.h
wctype.h