1 <!DOCTYPE HTML PUBLIC
"-//W3O//DTD W3 HTML 2.0//EN">
2 <!-- This collection of hypertext pages is Copyright 1995-7 by Steve Summit. -->
3 <!-- This material may be freely redistributed and used -->
4 <!-- but may not be republished or sold without permission. -->
7 <link rev=
"owner" href=
"mailto:scs@eskimo.com">
8 <link rev=
"made" href=
"mailto:scs@eskimo.com">
9 <title>16.10: File Operations
10 (
<TT>remove
</TT>,
<TT>rename
</TT>, etc.)
</title>
11 <link href=
"sx2i.html" rev=precedes
>
12 <link href=
"sx2k.html" rel=precedes
>
13 <link href=
"sx2.html" rev=subdocument
>
16 <H2>16.10: File Operations
17 (
<TT>remove
</TT>,
<TT>rename
</TT>, etc.)
</H2>
19 <p>You can delete a file
22 int remove(char *filename)
24 </p><p>You can rename a file by calling
26 int rename(char *oldname, char *newname)
28 Both of these functions return zero if they succeed
29 and a nonzero value if they fail.
30 </p><p>There are no standard C functions for dealing with directories
31 (e.g. listing or creating them).
33 you will find functions
<TT>mkdir
</TT> for making directories
34 and
<TT>rmdir
</TT> for removing them,
35 and a suite of functions
36 <TT>opendir
</TT>,
<TT>readdir
</TT>, and
<TT>closedir
</TT>
38 Since these functions aren't standard, however,
39 we won't talk about them here.
41 (They exist on most Unix systems,
42 but they're not standard under MS-DOS or Macintosh compilers,
43 although you can find implementations on the net.)
47 <a href=
"sx2i.html" rev=precedes
>prev
</a>
48 <a href=
"sx2k.html" rel=precedes
>next
</a>
49 <a href=
"sx2.html" rev=subdocument
>up
</a>
50 <a href=
"top.html">top
</a>
53 This page by
<a href=
"http://www.eskimo.com/~scs/">Steve Summit
</a>
54 //
<a href=
"copyright.html">Copyright
</a> 1996-
1999
55 //
<a href=
"mailto:scs@eskimo.com">mail feedback
</a>