* X more docs for C
[mascara-docs.git] / C / the.ansi.c.programming.language / c.programming.notes.int / sx2j.html
blobcfdc40356e2ea9a6a5c242d489d18899df04c1fe
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. -->
5 <html>
6 <head>
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>
14 </head>
15 <body>
16 <H2>16.10: File Operations
17 (<TT>remove</TT>, <TT>rename</TT>, etc.)</H2>
19 <p>You can delete a file
20 by calling
21 <pre>
22 int remove(char *filename)
23 </pre>
24 </p><p>You can rename a file by calling
25 <pre>
26 int rename(char *oldname, char *newname)
27 </pre>
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).
32 On many systems,
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>
37 for listing them.
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.)
44 </p><hr>
45 <p>
46 Read sequentially:
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>
51 </p>
52 <p>
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>
56 </p>
57 </body>
58 </html>