On this page
remove
Prev: perror | Up: stdio.h | Next: rename
Rel: stdio.h, stdio.h & File I/O Guide
Ref: cppreference — remove
Tags: #public #prog #c #stdlib #stdio #tier/standard
Include
#include <stdio.h>
Signature & Overview
int remove(const char *path);
Deletes the file (or empty directory) at path; returns 0 on success.
Notes & Pitfalls
- Returns
0on success, non-zero on failure (settingerrno).
Example
#include <assert.h>
#include <stdio.h>
int main(void) {
assert(remove("definitely_missing_file_xyz") != 0);
}
Linked from
Related notes
- tuts/c/stdlib/stdio/perror Linked here; links to this page; shared tags: #c, #prog, #stdio, #stdlib, #tier
- tuts/c/stdlib/stdio/rename Linked here; links to this page; shared tags: #c, #prog, #stdio, #stdlib, #tier
- tuts/c/stdlib/stdio Linked here; links to this page; shared tags: #c, #prog, #stdio, #stdlib
- tuts/c/stdlib/stdio_and_file_io Linked here; shared tags: #c, #prog, #stdlib
- tuts/c/stdlib/stdio/fclose shared tags: #c, #prog, #stdio, #stdlib, #tier
- tuts/c/stdlib/stdio/feof shared tags: #c, #prog, #stdio, #stdlib, #tier
- tuts/c/stdlib/stdio/ferror shared tags: #c, #prog, #stdio, #stdlib, #tier
- tuts/c/stdlib/stdio/fflush shared tags: #c, #prog, #stdio, #stdlib, #tier
- tuts/c/stdlib/stdio/fgets shared tags: #c, #prog, #stdio, #stdlib, #tier
- tuts/c/stdlib/stdio/fopen shared tags: #c, #prog, #stdio, #stdlib, #tier