Revision as of 14:51, 22 August 2010 editBiT (talk | contribs)Extended confirmed users, Pending changes reviewers3,958 editsNo edit summary← Previous edit |
Latest revision as of 23:46, 27 April 2023 edit undoSteel1943 (talk | contribs)Autopatrolled, Extended confirmed users, Page movers, Pending changes reviewers, Rollbackers, Template editors197,279 edits Rcat |
(9 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
|
|
#REDIRECT ] |
|
{{lowercase|title=remove}} |
|
|
'''remove''' is a ] in ] that removes a certain file. It is included in the ] ] <code>]</code>. |
|
|
|
|
|
|
|
{{Redirect category shell| |
|
The prototype of the function is as follows: |
|
|
|
{{R with history}} |
|
|
|
|
|
{{R to anchor}} |
|
<source lang="c"> |
|
|
⚫ |
}} |
|
int remove ( const char * filename ); |
|
|
</source> |
|
|
|
|
|
If successful, the function returns zero. Nonzero value is returned on failure and <code>errno</code> variable is set to corresponding error code. |
|
|
|
|
|
==Sample usage== |
|
|
|
|
|
The following program demonstrates common usage of <code>remove</code>: |
|
|
|
|
|
<source lang="c"> |
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
int main() { |
|
|
const char *filename = "a.txt"; |
|
|
remove (filename); |
|
|
return 0; |
|
|
} |
|
|
</source> |
|
|
|
|
|
<code>remove</code> can be used to remove the C executable after it has finished running where </code>]] refer to the number and value of the ]s where <code>argv</code> is the first argument, i.e. the name of the executable: |
|
|
|
|
|
<source lang="c"> |
|
|
#include <stdio.h> |
|
|
|
|
|
int main(int argc, *char argv) |
|
|
{ |
|
|
printf("Now removing the file %s.\n", argv); |
|
|
remove(argv); |
|
|
return 0; |
|
⚫ |
} |
|
|
</source> |
|
|
|
|
|
] |
|