### Question 19.16

How can I delete a file?

The Standard C Library function is `remove`. (This is therefore one of the few questions in this section for which the answer is not ``It's system-dependent.'') On older, pre-ANSI Unix systems, `remove` may not exist, in which case you can try `unlink`.

References: K&R2 Sec. B1.1 p. 242
ANSI Sec. 4.9.4.1
ISO Sec. 7.9.4.1
H&S Sec. 15.15 p. 382
PCS Sec. 12 pp. 208,220-221
POSIX Sec. 5.5.1, Sec. 8.2.4

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995 // mail feedback