void boinc_zip_(int* zipmode, const char* zipfile, const char* path, int zipfile_len, int path_len ) { //zipmode = 0 to unzip or 1 to zip. FORTRAN variable of type INTEGER. //zipfile, path = FORTRAN variables of type CHARACTER. STRING_FROM_FORTRAN zipfileff(zipfile, zipfile_len); STRING_FROM_FORTRAN pathff(path, path_len); zipfileff.strip_whitespace(); pathff.strip_whitespace(); boinc_zip(*zipmode,zipfileff.c_str(),pathff.c_str()); }
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; }
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; }