16.10: File Operations (remove, rename, etc.)

You can delete a file by calling

	int remove(char *filename)

You can rename a file by calling

	int rename(char *oldname, char *newname)
Both of these functions return zero if they succeed and a nonzero value if they fail.

There are no standard C functions for dealing with directories (e.g. listing or creating them). On many systems, you will find functions mkdir for making directories and rmdir for removing them, and a suite of functions opendir, readdir, and closedir for listing them. Since these functions aren't standard, however, we won't talk about them here. (They exist on most Unix systems, but they're not standard under MS-DOS or Macintosh compilers, although you can find implementations on the net.)


Read sequentially: prev next up top

This page by Steve Summit // Copyright 1996-1999 // mail feedback