我如何预定义文件名,这里必须专门输入。你能帮我这个吗? [英] How do I predefine filename, here it has to be entered specifically.Can you please help me with this?
本文介绍了我如何预定义文件名,这里必须专门输入。你能帮我这个吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
main()
{
int a;
char name [30];
printf(输入要删除的文件的名称);
得到(姓名);
a =删除(姓名);
if(a == 0)
{
printf(文件已成功删除);
}
其他
{
printf(FILE NOT FOUND);
perror(ERROR);
}
getch();
}
解决方案
尝试更改,
a =删除( name);
to
a = remove(the_file_name); //the_file_name是您要删除的文件的名称。
This is my code
main() { int a; char name[30]; printf("enter the name of the file to be deleted"); gets(name); a = remove(name); if(a == 0) { printf("the file has been deleted sucessfully"); } else { printf("FILE NOT FOUND"); perror("ERROR"); } getch(); }
解决方案
Try changing,
a = remove(name);
to
a = remove("the_file_name"); //"the_file_name" is the name of the file you want to delete.
这篇关于我如何预定义文件名,这里必须专门输入。你能帮我这个吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文