1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > c语言 函数的参数传递示例_C语言中带有示例的remove()函数

c语言 函数的参数传递示例_C语言中带有示例的remove()函数

时间:2024-06-17 23:02:38

相关推荐

c语言 函数的参数传递示例_C语言中带有示例的remove()函数

c语言 函数的参数传递示例

C语言中的remove()函数 (remove() function in C)

Theremove() functionis defined in the <stdio.h> header file.

remove()函数在<stdio.h>头文件中定义。

Prototype:

原型:

int remove(const char* filename);

Parameters:const char *filename

参数:const char *文件名

Return type:int

返回类型:int

Use of function:

使用功能:

When we are dealing with files then sometimes we need to erase or delete some files. In file handling, we useremove() functionto erase the files. Theprototype of the function remove()is int remove(const char* filename);

当我们处理文件时,有时我们需要擦除或删除一些文件。 在文件处理中,我们使用remove()函数擦除文件。函数remove()的原型是int remove(const char * filename);

Here, filename is the name of the file which has to be erased. It returns zero if the file is successfully deleted and non zero if an error occurred.

在这里, 文件名是必须删除的文件的名称。 如果成功删除了文件,则返回零;如果发生错误,则返回非零。

C语言中的remove()示例 (remove() example in C)

#include <stdio.h>#include <stdlib.h>int main(){FILE *f;//Check the existence of that fileif((f=fopen("includehelp.txt","r"))==NULL){printf("File does not exist...\n");}else{printf("File is exist.\n");}fclose(f);//remove fileif(remove("includehelp.txt"))printf("Remove error.....\n");elseprintf("File is removed\n");//Check the existence of that fileif((f=fopen("includehelp.txt","r"))==NULL){printf("File does not exist...\n");}else{printf("File is exist.\n");}fclose(f);return 0;}

Output

输出量

翻译自: /c-programs/remove-function-in-c-language-with-example.aspx

c语言 函数的参数传递示例

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。