コード例 #1
0
ファイル: test.cpp プロジェクト: AltroCoin/altrocoin
int main() {
    int retval = -2;
    ZipFileList zf;

#ifdef _WIN32
    // replace with the path/file wildcard of your choice
    string home = string("C:/Documents and Settings/All Users/Documents");
    string result_dir = home + string("/testresult");
    CreateDirectoryA(result_dir.c_str(), NULL);
    string zipfile = result_dir + string("/test.zip");
    string source_dir = home + string("/Testfiles");
    if (boinc_filelist(source_dir.c_str(), ".txt", &zf) && zf.size()) {
        retval = boinc_zip(ZIP_IT, zipfile, &zf);
        retval = boinc_zip(UNZIP_IT, zipfile, result_dir.c_str());
    }
#else
    string home = string(getenv("HOME"));
    string result_dir = home + string("/testresult");
    if (mkdir(result_dir.c_str(), 0777) < 0) {
        perror("mkdir");
    }
    string zipfile = result_dir + string("/test.zip");
    string source_dir = home + string("/Testfiles");
    if (boinc_filelist(source_dir, string(".txt"), &zf) && zf.size()) {
        retval = boinc_zip(ZIP_IT, zipfile, &zf);
        retval = boinc_zip(UNZIP_IT, zipfile, result_dir.c_str());
    }
#endif

   return retval;
}
コード例 #2
0
int main()
{
	int retval = -2;
        ZipFileList zf;

#ifdef _WIN32
	// replace with the path/file wildcard of your choice
	int retval = boinc_zip(ZIP_IT, 
              "e:\\temp\\netsup.vxd e:\\temp\\vredir.vxd", 
              "e:\\temp\\test.zip", NULL);
        retval = boinc_zip(UNZIP_IT, "e:\\temp\\test.zip", 
              "/home/carlc/testing", NULL);
#else
        std::string zipfile = "test.zip";
        if (boinc_filelist("/var/home/carlc/", ".txt", &zf) && zf.size()) {
	  retval = boinc_zip(ZIP_IT, zipfile, &zf);
          retval = boinc_zip(UNZIP_IT, zipfile, NULL);
        }
#endif

   return retval;
}
コード例 #3
0
int main(int argc, char* argv[])
{
	ZipFileList zflist;
#ifdef _WIN32
	boinc_filelist("c:\\temp", "", &zflist, SORT_NAME | SORT_ASCENDING);
#else
	boinc_filelist("/tmp/junk", "", &zflist, SORT_NAME | SORT_ASCENDING);
#endif
        int jj; 
		char strTmp[128], strTmp2[128];
		for (jj = 0; jj < zflist.size(); jj++) {
			printf("%s  %d\n", zflist[jj].c_str(), zflist[jj].m_statFile.st_mtime);
			// now gzip it, silly but see how it goes!
			sprintf(strTmp, "%s.gz", zflist[jj].c_str());
			sprintf(strTmp2, "%s.zip", strTmp);
                     printf("infile=%s  outfile=%s\n", strTmp, strTmp2);
			do_gzip(strTmp, zflist[jj].c_str());
                    boinc_zip(ZIP_IT, strTmp2, strTmp);
		}
    boinc_zip(UNZIP_IT, "/tmp/boinc_zip.zip", "/tmp/junk/boinc_zip");
    return 0;
}