实现了一个简单的功能可供复用的windows下功能,删除日期的可通过修改ONE_WEEK的宏定义来处理
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <stdio.h>
#include <sys/timeb.h>
#include <time.h>
#include <inttypes.h>
#include <winsock.h>
using namespace std;
#define ONE_WEEK 60*60*24*7
inline char * convertWide2Ascii(const wchar_t* wstr, char * out)
{
out[0] = 0;
if (0 == wstr) return 0;
int nRet = ::WideCharToMultiByte(GetACP(), 0, wstr, -1, out, wcslen(wstr) * 2 + 2, 0, 0);
out[nRet] = 0;
return out;
}
void RemoveWholeDir(const char *dir)
{
char cmd[200] = "";
sprintf(cmd, "rd %s /q /s", dir); //调用dos命令删除文件夹以及文件夹下的子目录
system(cmd);
}
void FileTimeToTime_t(FILETIME ft, time_t *t)
{
LONGLONG ll;
ULARGE_INTEGER ui;
ui.LowPart = ft.dwLowDateTime;
ui.HighPart = ft.dwHighDateTime;
ll = ft.dwHighDateTime << 32 &#