remove

转自:百度百科  http://baike.baidu.com/view/982238.htm#2


C语言中的Remove函数

简介

功 能: 删除一个文件,相当于unlink函数,但是如果它的filename参数是一个目录的话,其作用就相当于rmdir函数。
用 法: int remove(const char *filename);
remove函数图片

  remove函数图片

头文件:在 Visual C++ 6.0中可以用 stdio.h也可以用io.h,前者更普遍。
返回值:如果删除成功,remove返回0,否则返回EOF(-1)。

程序例:

#include < stdio.h>
int main(void)
{
char file[80];
/* prompt for file name to delete */
printf("File to delete: ");
gets(file);
/* delete the file */
if (remove(file) == 0)
printf("Removed %s.\n",file);
else
perror("remove");
return 0;
}

转载于:https://www.cnblogs.com/pamxy/archive/2013/03/05/2991509.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值