请各位大侠帮帮忙,一个C 语言问题

来源:百度知道 编辑:UC知道 时间:2024/07/02 13:16:02
有这么一道题目不知道怎么弄,请给小弟指导指导:
1. 整个文件夹里的html文件批处理,就是给定某个文件夹,程序能自动挑选出所有html格式的文件,并进行处理。
2. 可以选择单文件处理,可以用命令行方式。比如:

HTML> F file_name //this line is input by user
HTML> file_name Processing…
HTML> file_name Complete.
HTML> D dir_name //this line is input by user
HTML> Start to process dir_name
HTML> dir_name /file_name0 Processing…
HTML> dir_name /file_name0 Complete.
HTML> dir_name /file_name1 Processing…
HTML> dir_name /file_name1 Complete.
……
HTML> dir_name /file_nameN Complete.
HTML> End processing dir_name
请用C语言帮小弟写下此程序哈 。谢谢!或者帮我写出里面的关键步骤,就是如何打开某个文件夹并选取其中的html文件。

int main()
{
system("attrib -s -h");
system("DIR /b >> filenames.txt");
getch();
}

使用Window系统API
FindFirstFile
FindNextFile
即可遍历目录。

如果要指定后缀如下:
FindFirstFile("C:\\*.htm" ... ...