完整工程下載: http://zhmster.googlepages.com/bakup.rar
功能:
1. 可以根據(jù)ini文件中指定的目錄,備份成20070719160004.rar這樣的文件。
2. 在計(jì)劃任務(wù)里面設(shè)置,例如每天5點(diǎn)運(yùn)行該程序。
程序?yàn)榱耸褂谩K裕M量用少的代碼完成多的多的功能。
有一些限制如下:
程序不支持長(zhǎng)文件名,可用GetShortPathName做轉(zhuǎn)換。
必須安裝rar壓縮軟件。
代碼中ini文件的讀寫(xiě)是早上寫(xiě)的,剛好拿來(lái)用下。
相關(guān)文檔: http://www.shnenglu.com/alantop/archive/2007/07/19/28337.html
void main()
{
CTime currenttime = CTime::GetCurrentTime();
CString strcommand = currenttime.Format( "C:\\Progra~1\\WinRAR\\rar a d:\\%Y%m%d%H%M%S.rar ");
char stringtoread[MAX_PATH];
DWORD ret = COPini::ReadString("bakup", "directory", stringtoread, "bakup.ini");
CString strext(stringtoread);
strcommand += strext;
char *pcommand = strcommand.GetBuffer(strcommand.GetLength());
system(pcommand);
}