这是一个c++调用wget下载图片的小程序, 可以结合我前一篇博客, 自动下载网页图片。
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
using namespace std;
#include <windows.h>
#include <string>
#include <vector>
//file name max length
#define getFolderFile_max_length 1024
//dfs
bool dfsFolder(string rootPath, vector<string> &fileList, vector<FILETIME> &timelist)
{
WIN32_FIND_DATA findData;
HANDLE hError;
//构造路径
char nowPath[getFolderFile_max_length];
strcpy(nowPath, rootPath.c_str());
strcat(nowPath, "\\*.*");
//文件名
char fileName[getFolderFile_max_length];
hError = FindFirstFile(nowPath, &findData);
if (hError == INVALID_HANDLE_VALUE)
{
printf("搜索失败!");
return false;
}
while (::FindNextFile(hError, &findData))
{
//过虑.和..
if (strcmp(findDat