1<html lang="en"> 2<head> 3<title>remove - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Stdio.html#Stdio" title="Stdio"> 9<link rel="prev" href="putwchar.html#putwchar" title="putwchar"> 10<link rel="next" href="rename.html#rename" title="rename"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<meta http-equiv="Content-Style-Type" content="text/css"> 13<style type="text/css"><!-- 14 pre.display { font-family:inherit } 15 pre.format { font-family:inherit } 16 pre.smalldisplay { font-family:inherit; font-size:smaller } 17 pre.smallformat { font-family:inherit; font-size:smaller } 18 pre.smallexample { font-size:smaller } 19 pre.smalllisp { font-size:smaller } 20 span.sc { font-variant:small-caps } 21 span.roman { font-family:serif; font-weight:normal; } 22 span.sansserif { font-family:sans-serif; font-weight:normal; } 23--></style> 24<link rel="stylesheet" type="text/css" href="../cs.css"> 25</head> 26<body> 27<div class="node"> 28<a name="remove"></a> 29<p> 30Next: <a rel="next" accesskey="n" href="rename.html#rename">rename</a>, 31Previous: <a rel="previous" accesskey="p" href="putwchar.html#putwchar">putwchar</a>, 32Up: <a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a> 33<hr> 34</div> 35 36<h3 class="section">4.51 <code>remove</code>—delete a file's name</h3> 37 38<p><a name="index-remove-258"></a><a name="index-g_t_005fremove_005fr-259"></a><strong>Synopsis</strong> 39<pre class="example"> #include <stdio.h> 40 int remove(char *<var>filename</var>); 41 42 int _remove_r(struct _reent *<var>reent</var>, char *<var>filename</var>); 43 44</pre> 45 <p><strong>Description</strong><br> 46Use <code>remove</code> to dissolve the association between a particular 47filename (the string at <var>filename</var>) and the file it represents. 48After calling <code>remove</code> with a particular filename, you will no 49longer be able to open the file by that name. 50 51 <p>In this implementation, you may use <code>remove</code> on an open file without 52error; existing file descriptors for the file will continue to access 53the file's data until the program using them closes the file. 54 55 <p>The alternate function <code>_remove_r</code> is a reentrant version. The 56extra argument <var>reent</var> is a pointer to a reentrancy structure. 57 58 <p><br> 59<strong>Returns</strong><br> 60<code>remove</code> returns <code>0</code> if it succeeds, <code>-1</code> if it fails. 61 62 <p><br> 63<strong>Portability</strong><br> 64ANSI C requires <code>remove</code>, but only specifies that the result on 65failure be nonzero. The behavior of <code>remove</code> when you call it on an 66open file may vary among implementations. 67 68 <p>Supporting OS subroutine required: <code>unlink</code>. 69 70 <p><br> 71 72 </body></html> 73 74