How to delete a file without using remove system call in a C program?

前端 未结 5 903
抹茶落季
抹茶落季 2021-01-06 02:39

I\'ve been curious how rem in Linux works and trying to write my own C code that can delete a file but when I searched for the answer, I only got t

5条回答
  •  旧巷少年郎
    2021-01-06 03:11

    int unlink (const char *filename)
    

    The unlink function deletes the file name filename. The function unlink is declared in the header file unistd.h. This function returns 0 on successful completion, and -1 on error

提交回复
热议问题