需要帮助C代码删除文件 [英] Need help with C code to delete file

查看:101
本文介绍了需要帮助C代码删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程方面的佼佼者。有些人可以给我一个C代码来删除文件,这些文件的位置在文本文件中提到。例如,我有一个带有多个文件路径的文本文件(files.txt),每行一个。 C程序应该读取文本文件并逐个删除文件。



我更喜欢C,因为我需要创建一个16位的exe。如果有人知道从VBS创建16位exe的方法,我也非常感谢。



非常感谢。

I am a nowise in programming. Can some please give me a C code that will delete files, whose locations are mentioned in a text file. For example, I have a text file (files.txt) with multiple file paths, one per line. The C program should read the text file and delete the files one by one.

I prefer C because I need to create a 16 bit exe. If someone know a way to create 16-bit exe from VBS, I would really appreciate that as well.

Thanks a lot in advance.

推荐答案

逐行读取文件。

对于每一行,将其传递给删除功能:

Read the file, line by line.
For each line, pass it to the remove function:
status = remove(strFilename);
if(status == 0)
   {
   printf("%s file deleted successfully.\n", strFilename);
   }


这篇关于需要帮助C代码删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆